Delta semántico · 36
scripts/gentest/src/main.rs
src/compute/grid/alignment.rs
tests/generated/flex/flex_direction_column_direction_rtl.rs
tests/generated/flex/flex_direction_column_reverse_direction_rtl.rs
tests/generated/flex/flex_direction_row_direction_rtl.rs
tests/generated/flex/flex_direction_row_reverse_direction_rtl.rs
tests/generated/flex/mod.rs
tests/generated/grid/grid_absolute_direction_rtl.rs
tests/generated/grid/grid_basic_direction_rtl.rs
tests/generated/grid/grid_justify_content_end_direction_rtl.rs
tests/generated/grid/grid_justify_content_start_direction_rtl.rs
tests/generated/grid/grid_justify_items_sized_end_direction_rtl.rs
tests/generated/grid/grid_justify_items_sized_start_direction_rtl.rs
tests/generated/grid/mod.rs
diff --git a/scripts/gentest/src/main.rs b/scripts/gentest/src/main.rs
index ee7b15a1c..9da1d4f91 100644
--- a/scripts/gentest/src/main.rs
+++ b/scripts/gentest/src/main.rs
@@ -413,8 +413,8 @@ fn generate_node(ident: &str, node: &Value) -> TokenStream {
let direction = match style["direction"] {
Value::String(ref value) => match value.as_ref() {
- "rtl" => quote!(direction: taffy::style::Direction::RTL,),
- "ltr" => quote!(direction: taffy::style::Direction::LTR,),
+ "rtl" => quote!(direction: taffy::style::Direction::Rtl,),
+ "ltr" => quote!(direction: taffy::style::Direction::Ltr,),
_ => quote!(),
},
_ => quote!(),
diff --git a/src/compute/flexbox.rs b/src/compute/flexbox.rs
index aa0e044f7..4237963be 100644
--- a/src/compute/flexbox.rs
+++ b/src/compute/flexbox.rs
@@ -446,13 +446,7 @@ fn compute_constants(
let align_items = style.align_items().unwrap_or(AlignItems::Stretch);
let align_content = style.align_content().unwrap_or(AlignContent::Stretch);
- let mut justify_content = style.justify_content();
-
- if layout_direction.is_rtl() {
- if let Some(justify_content) = justify_content.as_mut() {
- justify_content.flip();
- }
- }
+ let justify_content = style.justify_content();
// 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
@@ -1936,9 +1930,9 @@ fn calculate_flex_item(
let offset_main = if direction.is_row() && layout_direction.is_rtl() {
*total_offset_main
- - item.offset_main
- - item.margin.main_end(direction)
- - (item.inset.main_end(direction).or(item.inset.main_start(direction).map(|pos| -pos)).unwrap_or(0.0))
+ + item.offset_main
+ + item.margin.main_end(direction)
+ + (item.inset.main_end(direction).or(item.inset.main_start(direction).map(|pos| -pos)).unwrap_or(0.0))
} else {
*total_offset_main
+ item.offset_main
@@ -1948,10 +1942,9 @@ fn calculate_flex_item(
let offset_cross = if direction.is_column() && layout_direction.is_rtl() {
total_offset_cross
- - item.offset_cross
- - line_offset_cross
- - item.margin.cross_end(direction)
- - (item.inset.cross_end(direction).or(item.inset.cross_start(direction).map(|pos| -pos)).unwrap_or(0.0))
+ + item.offset_cross
+ + item.margin.cross_start(direction)
+ + (item.inset.cross_start(direction).or(item.inset.cross_end(direction).map(|pos| -pos)).unwrap_or(0.0))
} else {
total_offset_cross
+ item.offset_cross
@@ -1961,7 +1954,8 @@ fn calculate_flex_item(
};
if direction.is_row() {
- let baseline_offset_cross = total_offset_cross + item.offset_cross + item.margin.cross_start(direction);
+ let baseline_offset_cross =
+ total_offset_cross + item.offset_cross + line_offset_cross + item.margin.cross_start(direction);
let inner_baseline = layout_output.first_baselines.y.unwrap_or(size.height);
item.baseline = baseline_offset_cross + inner_baseline;
} else {
diff --git a/src/compute/grid/alignment.rs b/src/compute/grid/alignment.rs
index 09db9d32d..771869dc6 100644
--- a/src/compute/grid/alignment.rs
+++ b/src/compute/grid/alignment.rs
@@ -9,7 +9,7 @@ use crate::util::{MaybeMath, MaybeResolve, ResolveOrZero};
#[cfg(feature = "content_size")]
use crate::compute::common::content_size::compute_content_size_contribution;
-use crate::{BoxSizing, LayoutGridContainer};
+use crate::{BoxSizing, Direction, LayoutGridContainer};
/// 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,6 +63,7 @@ pub(super) fn align_and_position_item(
grid_area: Rect<f32>,
container_alignment_styles: InBothAbsAxis<Option<AlignItems>>,
baseline_shim: f32,
+ direction: Direction,
) -> (Size<f32>, f32, f32) {
let grid_area_size = Size { width: grid_area.right - grid_area.left, height: grid_area.bottom - grid_area.top };
@@ -198,7 +199,7 @@ pub(super) fn align_and_position_item(
let Size { width, height } = Size { width, height }.maybe_clamp(min_size, max_size);
// Layout node
- let direction = style.direction();
+ let item_direction = style.direction();
drop(style);
let size = if position == Position::Absolute && (width.is_none() || height.is_none()) {
@@ -208,7 +209,7 @@ pub(super) fn align_and_position_item(
grid_area_size.map(Option::Some),
grid_area_minus_item_margins_size.map(AvailableSpace::Definite),
SizingMode::InherentSize,
- direction,
+ item_direction,
Line::FALSE,
)
.map(Some)
@@ -222,7 +223,7 @@ pub(super) fn align_and_position_item(
grid_area_size.map(Option::Some),
grid_area_minus_item_margins_size.map(AvailableSpace::Definite),
SizingMode::InherentSize,
- direction,
+ item_direction,
Line::FALSE,
);
@@ -237,6 +238,7 @@ pub(super) fn align_and_position_item(
inset_horizontal,
margin.horizontal_components(),
0.0,
+ direction,
);
let (y, y_margin) = align_item_within_area(
Line { start: grid_area.top, end: grid_area.bottom },
@@ -246,6 +248,7 @@ pub(super) fn align_and_position_item(
inset_vertical,
margin.vertical_components(),
baseline_shim,
+ Direction::Ltr,
);
let scrollbar_size = Size {
@@ -280,6 +283,7 @@ pub(super) fn align_and_position_item(
}
/// Align and size a grid item along a single axis
+#[allow(clippy::too_many_arguments)]
pub(super) fn align_item_within_area(
grid_area: Line<f32>,
alignment_style: AlignSelf,
@@ -288,6 +292,7 @@ pub(super) fn align_item_within_area(
inset: Line<Option<f32>>,
margin: Line<Option<f32>>,
baseline_shim: f32,
+ direction: Direction,
) -> (f32, Line<f32>) {
// Calculate grid area dimension in the axis
let non_auto_margin = Line { start: margin.start.unwrap_or(0.0) + baseline_shim, end: margin.end.unwrap_or(0.0) };
@@ -304,12 +309,36 @@ pub(super) fn align_item_within_area(
// Compute offset in the axis
let alignment_based_offset = match alignment_style {
- AlignSelf::Start | AlignSelf::FlexStart => resolved_margin.start,
- AlignSelf::End | AlignSelf::FlexEnd => grid_area_size - resolved_size - resolved_margin.end,
+ AlignSelf::Start | AlignSelf::FlexStart => {
+ if direction.is_rtl() {
+ free_space + resolved_margin.start
+ } else {
+ resolved_margin.start
+ }
+ }
+ AlignSelf::End | AlignSelf::FlexEnd => {
+ if direction.is_rtl() {
+ resolved_margin.start
+ } else {
+ grid_area_size - resolved_size - resolved_margin.end
+ }
+ }
AlignSelf::Center => (grid_area_size - resolved_size + resolved_margin.start - resolved_margin.end) / 2.0,
// TODO: Add support for baseline alignment. For now we treat it as "start".
- AlignSelf::Baseline => resolved_margin.start,
- AlignSelf::Stretch => resolved_margin.start,
+ AlignSelf::Baseline => {
+ if direction.is_rtl() {
+ free_space + resolved_margin.start
+ } else {
+ resolved_margin.start
+ }
+ }
+ AlignSelf::Stretch => {
+ if direction.is_rtl() {
+ free_space + resolved_margin.start
+ } else {
+ resolved_margin.start
+ }
+ }
};
let offset_within_area = if position == Position::Absolute {
diff --git a/src/compute/grid/mod.rs b/src/compute/grid/mod.rs
index 47f4bc6c0..811016f15 100644
--- a/src/compute/grid/mod.rs
+++ b/src/compute/grid/mod.rs
@@ -95,17 +95,9 @@ pub fn compute_grid_layout<Tree: LayoutGridContainer>(
};
let align_content = style.align_content().unwrap_or(AlignContent::Stretch);
- let mut justify_content = style.justify_content().unwrap_or(JustifyContent::Stretch);
+ let justify_content = style.justify_content().unwrap_or(JustifyContent::Stretch);
let align_items = style.align_items();
- let mut justify_items = style.justify_items();
-
- if direction.is_rtl() {
- justify_content.flip();
-
- if let Some(justify_items) = justify_items.as_mut() {
- justify_items.flip();
- }
- }
+ let justify_items = style.justify_items();
// Note: we avoid accessing the grid rows/columns methods more than once as this can
// cause an expensive-ish computation
@@ -512,7 +504,7 @@ pub fn compute_grid_layout<Tree: LayoutGridContainer>(
// Position in-flow children (stored in items vector)
for (index, item) in items.iter_mut().enumerate() {
- let (left, right) = match item.direction {
+ let (left, right) = match direction {
Direction::Ltr => (
columns[item.column_indexes.start as usize + 1].offset,
columns[item.column_indexes.end as usize].offset,
@@ -537,6 +529,7 @@ pub fn compute_grid_layout<Tree: LayoutGridContainer>(
grid_area,
container_alignment_styles,
item.baseline_shim,
+ direction,
);
item.y_position = y_position;
item.height = height;
@@ -601,11 +594,14 @@ pub fn compute_grid_layout<Tree: LayoutGridContainer>(
.unwrap_or(container_border_box.width - border.right - scrollbar_gutter.x),
),
Direction::Rtl => (
+ maybe_col_indexes
+ .end
+ .map(|index| container_border_box.width - columns[index].offset)
+ .unwrap_or(border.left + scrollbar_gutter.x),
maybe_col_indexes
.start
- .map(|index| columns[index].offset + border.left + scrollbar_gutter.x)
- .unwrap_or(border.left),
- maybe_col_indexes.end.map(|index| columns[index].offset).unwrap_or(container_border_box.width),
+ .map(|index| container_border_box.width - columns[index].offset)
+ .unwrap_or(container_border_box.width - border.right),
),
};
let grid_area = Rect {
@@ -622,7 +618,7 @@ pub fn compute_grid_layout<Tree: LayoutGridContainer>(
// 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);
+ align_and_position_item(tree, child, order, grid_area, container_alignment_styles, 0.0, direction);
#[cfg(feature = "content_size")]
{
item_content_size_contribution = item_content_size_contribution.f32_max(content_size_contribution);
diff --git a/test_fixtures/flex/flex_direction_column_direction_rtl.html b/test_fixtures/flex/flex_direction_column_direction_rtl.html
new file mode 100644
index 000000000..a4a502a92
--- /dev/null
+++ b/test_fixtures/flex/flex_direction_column_direction_rtl.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <script src="../../scripts/gentest/test_helper.js"></script>
+ <link rel="stylesheet" type="text/css" href="../../scripts/gentest/test_base_style.css">
+ <title>
+ Test description
+ </title>
+</head>
+<body>
+
+<div id="test-root" style="height: 100px; width: 100px; flex-direction: column; direction: rtl;">
+ <div style="width: 10px;"></div>
+ <div style="width: 10px;"></div>
+ <div style="width: 10px;"></div>
+</div>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/test_fixtures/flex/flex_direction_column_reverse_direction_rtl.html b/test_fixtures/flex/flex_direction_column_reverse_direction_rtl.html
new file mode 100644
index 000000000..be01184fd
--- /dev/null
+++ b/test_fixtures/flex/flex_direction_column_reverse_direction_rtl.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <script src="../../scripts/gentest/test_helper.js"></script>
+ <link rel="stylesheet" type="text/css" href="../../scripts/gentest/test_base_style.css">
+ <title>
+ Test description
+ </title>
+</head>
+<body>
+
+<div id="test-root" style="height: 100px; width: 100px; flex-direction: column-reverse; direction: rtl;">
+ <div style="width: 10px;"></div>
+ <div style="width: 10px;"></div>
+ <div style="width: 10px;"></div>
+</div>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/test_fixtures/flex/flex_direction_row_direction_rtl.html b/test_fixtures/flex/flex_direction_row_direction_rtl.html
new file mode 100644
index 000000000..b4532f549
--- /dev/null
+++ b/test_fixtures/flex/flex_direction_row_direction_rtl.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <script src="../../scripts/gentest/test_helper.js"></script>
+ <link rel="stylesheet" type="text/css" href="../../scripts/gentest/test_base_style.css">
+ <title>
+ Test description
+ </title>
+</head>
+<body>
+
+<div id="test-root" style="height: 100px; width: 100px; direction: rtl;">
+ <div style="width: 10px;"></div>
+ <div style="width: 10px;"></div>
+ <div style="width: 10px;"></div>
+</div>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/test_fixtures/flex/flex_direction_row_reverse_direction_rtl.html b/test_fixtures/flex/flex_direction_row_reverse_direction_rtl.html
new file mode 100644
index 000000000..2ce111147
--- /dev/null
+++ b/test_fixtures/flex/flex_direction_row_reverse_direction_rtl.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <script src="../../scripts/gentest/test_helper.js"></script>
+ <link rel="stylesheet" type="text/css" href="../../scripts/gentest/test_base_style.css">
+ <title>
+ Test description
+ </title>
+</head>
+<body>
+
+<div id="test-root" style="height: 100px; width: 100px; flex-direction: row-reverse; direction: rtl;">
+ <div style="width: 10px;"></div>
+ <div style="width: 10px;"></div>
+ <div style="width: 10px;"></div>
+</div>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/test_fixtures/grid/grid_absolute_direction_rtl.html b/test_fixtures/grid/grid_absolute_direction_rtl.html
new file mode 100644
index 000000000..808ca772b
--- /dev/null
+++ b/test_fixtures/grid/grid_absolute_direction_rtl.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <script src="../../scripts/gentest/test_helper.js"></script>
+ <link rel="stylesheet" type="text/css" href="../../scripts/gentest/test_base_style.css">
+ <title>
+ Test description
+ </title>
+</head>
+<body>
+
+<div id="test-root" style="height: 200px; width: 200px; display: grid; grid-template-columns: 40px 40px 40px; grid-template-rows: 40px 40px 40px; direction: rtl; position: relative;">
+ <div style="position: absolute; grid-column: 1 / 2; grid-row: 1 / 2; width: 20px; height: 20px; background-color: red;"></div>
+</div>
+
+</body>
+</html>
diff --git a/test_fixtures/grid/grid_basic_direction_rtl.html b/test_fixtures/grid/grid_basic_direction_rtl.html
new file mode 100644
index 000000000..990ba0899
--- /dev/null
+++ b/test_fixtures/grid/grid_basic_direction_rtl.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <script src="../../scripts/gentest/test_helper.js"></script>
+ <link rel="stylesheet" type="text/css" href="../../scripts/gentest/test_base_style.css">
+ <title>
+ Test description
+ </title>
+</head>
+<body>
+
+<div id="test-root" style="height: 120px; width: 120px; display: grid; grid-template-columns: 40px 40px 40px; grid-template-rows: 40px 40px 40px; direction: rtl;">
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+</div>
+
+</body>
+</html>
diff --git a/test_fixtures/grid/grid_justify_content_end_direction_rtl.html b/test_fixtures/grid/grid_justify_content_end_direction_rtl.html
new file mode 100644
index 000000000..bbf2ca899
--- /dev/null
+++ b/test_fixtures/grid/grid_justify_content_end_direction_rtl.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <script src="../../scripts/gentest/test_helper.js"></script>
+ <link rel="stylesheet" type="text/css" href="../../scripts/gentest/test_base_style.css">
+ <title>
+ Test description
+ </title>
+</head>
+<body>
+
+<div id="test-root" style="height: 200px; width: 200px; display: grid; grid-template-columns: 40px 40px 40px; grid-template-rows: 40px 40px 40px; justify-content: end; direction: rtl;">
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+</div>
+
+</body>
+</html>
diff --git a/test_fixtures/grid/grid_justify_content_start_direction_rtl.html b/test_fixtures/grid/grid_justify_content_start_direction_rtl.html
new file mode 100644
index 000000000..5ab2edbcc
--- /dev/null
+++ b/test_fixtures/grid/grid_justify_content_start_direction_rtl.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <script src="../../scripts/gentest/test_helper.js"></script>
+ <link rel="stylesheet" type="text/css" href="../../scripts/gentest/test_base_style.css">
+ <title>
+ Test description
+ </title>
+</head>
+<body>
+
+<div id="test-root" style="height: 200px; width: 200px; display: grid; grid-template-columns: 40px 40px 40px; grid-template-rows: 40px 40px 40px; justify-content: start; direction: rtl;">
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+ <div></div>
+</div>
+
+</body>
+</html>
diff --git a/test_fixtures/grid/grid_justify_items_sized_end_direction_rtl.html b/test_fixtures/grid/grid_justify_items_sized_end_direction_rtl.html
new file mode 100644
index 000000000..23aebe104
--- /dev/null
+++ b/test_fixtures/grid/grid_justify_items_sized_end_direction_rtl.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <script src="../../scripts/gentest/test_helper.js"></script>
+ <link rel="stylesheet" type="text/css" href="../../scripts/gentest/test_base_style.css">
+ <title>
+ Test description
+ </title>
+</head>
+<body>
+
+<div id="test-root" style="height: 120px; width: 120px; display: grid; grid-template-columns: 40px 40px 40px; grid-template-rows: 40px 40px 40px; justify-items: end; direction: rtl;">
+ <div style="width: 20px; height: 20px; grid-row: 1; grid-column: 1;"></div>
+ <div style="width: 20px; height: 20px; grid-row: 3; grid-column: 3;"></div>
+</div>
+
+</body>
+</html>
diff --git a/test_fixtures/grid/grid_justify_items_sized_start_direction_rtl.html b/test_fixtures/grid/grid_justify_items_sized_start_direction_rtl.html
new file mode 100644
index 000000000..010396b95
--- /dev/null
+++ b/test_fixtures/grid/grid_justify_items_sized_start_direction_rtl.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <script src="../../scripts/gentest/test_helper.js"></script>
+ <link rel="stylesheet" type="text/css" href="../../scripts/gentest/test_base_style.css">
+ <title>
+ Test description
+ </title>
+</head>
+<body>
+
+<div id="test-root" style="height: 120px; width: 120px; display: grid; grid-template-columns: 40px 40px 40px; grid-template-rows: 40px 40px 40px; justify-items: start; direction: rtl;">
+ <div style="width: 20px; height: 20px; grid-row: 1; grid-column: 1;"></div>
+ <div style="width: 20px; height: 20px; grid-row: 3; grid-column: 3;"></div>
+</div>
+
+</body>
+</html>
diff --git a/tests/generated/flex/flex_direction_column_direction_rtl.rs b/tests/generated/flex/flex_direction_column_direction_rtl.rs
new file mode 100644
index 000000000..4a2838ac2
--- /dev/null
+++ b/tests/generated/flex/flex_direction_column_direction_rtl.rs
@@ -0,0 +1,139 @@
+#[test]
+#[allow(non_snake_case)]
+fn flex_direction_column_direction_rtl__border_box() {
+ #[allow(unused_imports)]
+ use taffy::{prelude::*, Layout};
+ let mut taffy = crate::new_test_tree();
+ let node0 = taffy
+ .new_leaf(taffy::style::Style {
+ size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() },
+ ..Default::default()
+ })
+ .unwrap();
+ let node1 = taffy
+ .new_leaf(taffy::style::Style {
+ size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() },
+ ..Default::default()
+ })
+ .unwrap();
+ let node2 = taffy
+ .new_leaf(taffy::style::Style {
+ size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() },
+ ..Default::default()
+ })
+ .unwrap();
+ let node = taffy
+ .new_with_children(
+ taffy::style::Style {
+ direction: taffy::style::Direction::Rtl,
+ flex_direction: taffy::style::FlexDirection::Column,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(100f32),
+ height: taffy::style::Dimension::from_length(100f32),
+ },
+ ..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);
+ println!();
+ let layout = taffy.layout(node).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width);
+ assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y);
+ 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, 90f32, "x of node {:?}. Expected {}. Actual {}", node0, 90f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y);
+ 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, 90f32, "x of node {:?}. Expected {}. Actual {}", node1, 90f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y);
+ 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, 0f32, "height of node {:?}. Expected {}. Actual {}", node2, 0f32, 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);
+}
+
+#[test]
+#[allow(non_snake_case)]
+fn flex_direction_column_direction_rtl__content_box() {
+ #[allow(unused_imports)]
+ 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,
+ size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() },
+ ..Default::default()
+ })
+ .unwrap();
+ let node1 = taffy
+ .new_leaf(taffy::style::Style {
+ box_sizing: taffy::style::BoxSizing::ContentBox,
+ 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,
+ size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() },
+ ..Default::default()
+ })
+ .unwrap();
+ let node = taffy
+ .new_with_children(
+ taffy::style::Style {
+ box_sizing: taffy::style::BoxSizing::ContentBox,
+ direction: taffy::style::Direction::Rtl,
+ flex_direction: taffy::style::FlexDirection::Column,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(100f32),
+ height: taffy::style::Dimension::from_length(100f32),
+ },
+ ..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);
+ println!();
+ let layout = taffy.layout(node).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width);
+ assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y);
+ 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, 90f32, "x of node {:?}. Expected {}. Actual {}", node0, 90f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y);
+ 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, 90f32, "x of node {:?}. Expected {}. Actual {}", node1, 90f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node1, 0f32, location.y);
+ 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, 0f32, "height of node {:?}. Expected {}. Actual {}", node2, 0f32, 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);
+}
diff --git a/tests/generated/flex/flex_direction_column_reverse_direction_rtl.rs b/tests/generated/flex/flex_direction_column_reverse_direction_rtl.rs
new file mode 100644
index 000000000..0e65e335e
--- /dev/null
+++ b/tests/generated/flex/flex_direction_column_reverse_direction_rtl.rs
@@ -0,0 +1,139 @@
+#[test]
+#[allow(non_snake_case)]
+fn flex_direction_column_reverse_direction_rtl__border_box() {
+ #[allow(unused_imports)]
+ use taffy::{prelude::*, Layout};
+ let mut taffy = crate::new_test_tree();
+ let node0 = taffy
+ .new_leaf(taffy::style::Style {
+ size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() },
+ ..Default::default()
+ })
+ .unwrap();
+ let node1 = taffy
+ .new_leaf(taffy::style::Style {
+ size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() },
+ ..Default::default()
+ })
+ .unwrap();
+ let node2 = taffy
+ .new_leaf(taffy::style::Style {
+ size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() },
+ ..Default::default()
+ })
+ .unwrap();
+ let node = taffy
+ .new_with_children(
+ taffy::style::Style {
+ direction: taffy::style::Direction::Rtl,
+ flex_direction: taffy::style::FlexDirection::ColumnReverse,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(100f32),
+ height: taffy::style::Dimension::from_length(100f32),
+ },
+ ..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);
+ println!();
+ let layout = taffy.layout(node).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width);
+ assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y);
+ 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, 90f32, "x of node {:?}. Expected {}. Actual {}", node0, 90f32, location.x);
+ assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node0, 100f32, location.y);
+ 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, 90f32, "x of node {:?}. Expected {}. Actual {}", node1, 90f32, location.x);
+ assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node1, 100f32, location.y);
+ 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, 0f32, "height of node {:?}. Expected {}. Actual {}", node2, 0f32, size.height);
+ assert_eq!(location.x, 90f32, "x of node {:?}. Expected {}. Actual {}", node2, 90f32, location.x);
+ assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node2, 100f32, location.y);
+}
+
+#[test]
+#[allow(non_snake_case)]
+fn flex_direction_column_reverse_direction_rtl__content_box() {
+ #[allow(unused_imports)]
+ 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,
+ size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() },
+ ..Default::default()
+ })
+ .unwrap();
+ let node1 = taffy
+ .new_leaf(taffy::style::Style {
+ box_sizing: taffy::style::BoxSizing::ContentBox,
+ 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,
+ size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() },
+ ..Default::default()
+ })
+ .unwrap();
+ let node = taffy
+ .new_with_children(
+ taffy::style::Style {
+ box_sizing: taffy::style::BoxSizing::ContentBox,
+ direction: taffy::style::Direction::Rtl,
+ flex_direction: taffy::style::FlexDirection::ColumnReverse,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(100f32),
+ height: taffy::style::Dimension::from_length(100f32),
+ },
+ ..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);
+ println!();
+ let layout = taffy.layout(node).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width);
+ assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y);
+ 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, 90f32, "x of node {:?}. Expected {}. Actual {}", node0, 90f32, location.x);
+ assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node0, 100f32, location.y);
+ 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, 90f32, "x of node {:?}. Expected {}. Actual {}", node1, 90f32, location.x);
+ assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node1, 100f32, location.y);
+ 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, 0f32, "height of node {:?}. Expected {}. Actual {}", node2, 0f32, size.height);
+ assert_eq!(location.x, 90f32, "x of node {:?}. Expected {}. Actual {}", node2, 90f32, location.x);
+ assert_eq!(location.y, 100f32, "y of node {:?}. Expected {}. Actual {}", node2, 100f32, location.y);
+}
diff --git a/tests/generated/flex/flex_direction_row_direction_rtl.rs b/tests/generated/flex/flex_direction_row_direction_rtl.rs
new file mode 100644
index 000000000..ec522aa7c
--- /dev/null
+++ b/tests/generated/flex/flex_direction_row_direction_rtl.rs
@@ -0,0 +1,137 @@
+#[test]
+#[allow(non_snake_case)]
+fn flex_direction_row_direction_rtl__border_box() {
+ #[allow(unused_imports)]
+ use taffy::{prelude::*, Layout};
+ let mut taffy = crate::new_test_tree();
+ let node0 = taffy
+ .new_leaf(taffy::style::Style {
+ size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() },
+ ..Default::default()
+ })
+ .unwrap();
+ let node1 = taffy
+ .new_leaf(taffy::style::Style {
+ size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() },
+ ..Default::default()
+ })
+ .unwrap();
+ let node2 = taffy
+ .new_leaf(taffy::style::Style {
+ size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() },
+ ..Default::default()
+ })
+ .unwrap();
+ let node = taffy
+ .new_with_children(
+ taffy::style::Style {
+ direction: taffy::style::Direction::Rtl,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(100f32),
+ height: taffy::style::Dimension::from_length(100f32),
+ },
+ ..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);
+ println!();
+ let layout = taffy.layout(node).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width);
+ assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y);
+ 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);
+ 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);
+ 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);
+}
+
+#[test]
+#[allow(non_snake_case)]
+fn flex_direction_row_direction_rtl__content_box() {
+ #[allow(unused_imports)]
+ 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,
+ size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() },
+ ..Default::default()
+ })
+ .unwrap();
+ let node1 = taffy
+ .new_leaf(taffy::style::Style {
+ box_sizing: taffy::style::BoxSizing::ContentBox,
+ 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,
+ size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() },
+ ..Default::default()
+ })
+ .unwrap();
+ let node = taffy
+ .new_with_children(
+ taffy::style::Style {
+ box_sizing: taffy::style::BoxSizing::ContentBox,
+ direction: taffy::style::Direction::Rtl,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(100f32),
+ height: taffy::style::Dimension::from_length(100f32),
+ },
+ ..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);
+ println!();
+ let layout = taffy.layout(node).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width);
+ assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y);
+ 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);
+ 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);
+ 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);
+}
diff --git a/tests/generated/flex/flex_direction_row_reverse_direction_rtl.rs b/tests/generated/flex/flex_direction_row_reverse_direction_rtl.rs
new file mode 100644
index 000000000..b9c94b9ae
--- /dev/null
+++ b/tests/generated/flex/flex_direction_row_reverse_direction_rtl.rs
@@ -0,0 +1,139 @@
+#[test]
+#[allow(non_snake_case)]
+fn flex_direction_row_reverse_direction_rtl__border_box() {
+ #[allow(unused_imports)]
+ use taffy::{prelude::*, Layout};
+ let mut taffy = crate::new_test_tree();
+ let node0 = taffy
+ .new_leaf(taffy::style::Style {
+ size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() },
+ ..Default::default()
+ })
+ .unwrap();
+ let node1 = taffy
+ .new_leaf(taffy::style::Style {
+ size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() },
+ ..Default::default()
+ })
+ .unwrap();
+ let node2 = taffy
+ .new_leaf(taffy::style::Style {
+ size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() },
+ ..Default::default()
+ })
+ .unwrap();
+ let node = taffy
+ .new_with_children(
+ taffy::style::Style {
+ direction: taffy::style::Direction::Rtl,
+ flex_direction: taffy::style::FlexDirection::RowReverse,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(100f32),
+ height: taffy::style::Dimension::from_length(100f32),
+ },
+ ..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);
+ println!();
+ let layout = taffy.layout(node).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width);
+ assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y);
+ 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);
+ 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);
+ 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);
+}
+
+#[test]
+#[allow(non_snake_case)]
+fn flex_direction_row_reverse_direction_rtl__content_box() {
+ #[allow(unused_imports)]
+ 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,
+ size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() },
+ ..Default::default()
+ })
+ .unwrap();
+ let node1 = taffy
+ .new_leaf(taffy::style::Style {
+ box_sizing: taffy::style::BoxSizing::ContentBox,
+ 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,
+ size: taffy::geometry::Size { width: taffy::style::Dimension::from_length(10f32), height: auto() },
+ ..Default::default()
+ })
+ .unwrap();
+ let node = taffy
+ .new_with_children(
+ taffy::style::Style {
+ box_sizing: taffy::style::BoxSizing::ContentBox,
+ direction: taffy::style::Direction::Rtl,
+ flex_direction: taffy::style::FlexDirection::RowReverse,
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(100f32),
+ height: taffy::style::Dimension::from_length(100f32),
+ },
+ ..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);
+ println!();
+ let layout = taffy.layout(node).unwrap();
+ let Layout { size, location, .. } = layout;
+ assert_eq!(size.width, 100f32, "width of node {:?}. Expected {}. Actual {}", node, 100f32, size.width);
+ assert_eq!(size.height, 100f32, "height of node {:?}. Expected {}. Actual {}", node, 100f32, size.height);
+ assert_eq!(location.x, 0f32, "x of node {:?}. Expected {}. Actual {}", node, 0f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node, 0f32, location.y);
+ 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);
+ 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);
+ 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);
+}
diff --git a/tests/generated/flex/mod.rs b/tests/generated/flex/mod.rs
index aabd9865a..246de384c 100644
--- a/tests/generated/flex/mod.rs
+++ b/tests/generated/flex/mod.rs
@@ -236,12 +236,16 @@ mod flex_basis_unconstraint_row;
mod flex_basis_zero_undefined_main_size;
mod flex_column_relative_all_sides;
mod flex_direction_column;
+mod flex_direction_column_direction_rtl;
mod flex_direction_column_no_height;
mod flex_direction_column_reverse;
+mod flex_direction_column_reverse_direction_rtl;
mod flex_direction_column_reverse_no_height;
mod flex_direction_row;
+mod flex_direction_row_direction_rtl;
mod flex_direction_row_no_width;
mod flex_direction_row_reverse;
+mod flex_direction_row_reverse_direction_rtl;
mod flex_grow_0_min_size;
mod flex_grow_child;
mod flex_grow_flex_basis_percent_min_max;
diff --git a/tests/generated/grid/grid_absolute_direction_rtl.rs b/tests/generated/grid/grid_absolute_direction_rtl.rs
new file mode 100644
index 000000000..0cfff8d33
--- /dev/null
+++ b/tests/generated/grid/grid_absolute_direction_rtl.rs
@@ -0,0 +1,105 @@
+#[test]
+#[allow(non_snake_case)]
+fn grid_absolute_direction_rtl__border_box() {
+ #[allow(unused_imports)]
+ use taffy::{prelude::*, Layout};
+ let mut taffy = crate::new_test_tree();
+ let node0 = taffy
+ .new_leaf(taffy::style::Style {
+ position: taffy::style::Position::Absolute,
+ grid_row: taffy::geometry::Line { start: line(1i16), end: line(2i16) },
+ grid_column: taffy::geometry::Line { start: line(1i16), end: line(2i16) },
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(20f32),
+ height: taffy::style::Dimension::from_length(20f32),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node = taffy
+ .new_with_children(
+ taffy::style::Style {
+ display: taffy::style::Display::Grid,
+ direction: taffy::style::Direction::Rtl,
+ grid_template_rows: vec![length(40f32), length(40f32), length(40f32)],
+ grid_template_columns: vec![length(40f32), length(40f32), length(40f32)],
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(200f32),
+ height: taffy::style::Dimension::from_length(200f32),
+ },
+ ..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 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);
+ 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, 180f32, "x of node {:?}. Expected {}. Actual {}", node0, 180f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y);
+}
+
+#[test]
+#[allow(non_snake_case)]
+fn grid_absolute_direction_rtl__content_box() {
+ #[allow(unused_imports)]
+ 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,
+ position: taffy::style::Position::Absolute,
+ grid_row: taffy::geometry::Line { start: line(1i16), end: line(2i16) },
+ grid_column: taffy::geometry::Line { start: line(1i16), end: line(2i16) },
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(20f32),
+ height: taffy::style::Dimension::from_length(20f32),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node = taffy
+ .new_with_children(
+ taffy::style::Style {
+ display: taffy::style::Display::Grid,
+ box_sizing: taffy::style::BoxSizing::ContentBox,
+ direction: taffy::style::Direction::Rtl,
+ grid_template_rows: vec![length(40f32), length(40f32), length(40f32)],
+ grid_template_columns: vec![length(40f32), length(40f32), length(40f32)],
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(200f32),
+ height: taffy::style::Dimension::from_length(200f32),
+ },
+ ..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 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);
+ 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, 180f32, "x of node {:?}. Expected {}. Actual {}", node0, 180f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y);
+}
diff --git a/tests/generated/grid/grid_basic_direction_rtl.rs b/tests/generated/grid/grid_basic_direction_rtl.rs
new file mode 100644
index 000000000..7ecfe0f42
--- /dev/null
+++ b/tests/generated/grid/grid_basic_direction_rtl.rs
@@ -0,0 +1,212 @@
+#[test]
+#[allow(non_snake_case)]
+fn grid_basic_direction_rtl__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 node = taffy
+ .new_with_children(
+ taffy::style::Style {
+ display: taffy::style::Display::Grid,
+ direction: taffy::style::Direction::Rtl,
+ grid_template_rows: vec![length(40f32), length(40f32), length(40f32)],
+ grid_template_columns: vec![length(40f32), length(40f32), length(40f32)],
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(120f32),
+ height: taffy::style::Dimension::from_length(120f32),
+ },
+ ..Default::default()
+ },
+ &[node0, node1, node2, node3, node4, node5, node6, node7, node8],
+ )
+ .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 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);
+ let layout = taffy.layout(node0).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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y);
+}
+
+#[test]
+#[allow(non_snake_case)]
+fn grid_basic_direction_rtl__content_box() {
+ #[allow(unused_imports)]
+ 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() })
+ .unwrap();
+ let node1 = taffy
+ .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() })
+ .unwrap();
+ let node2 = taffy
+ .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() })
+ .unwrap();
+ let node3 = taffy
+ .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() })
+ .unwrap();
+ let node4 = taffy
+ .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() })
+ .unwrap();
+ let node5 = taffy
+ .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() })
+ .unwrap();
+ let node6 = taffy
+ .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() })
+ .unwrap();
+ let node7 = taffy
+ .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() })
+ .unwrap();
+ let node8 = taffy
+ .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() })
+ .unwrap();
+ let node = taffy
+ .new_with_children(
+ taffy::style::Style {
+ display: taffy::style::Display::Grid,
+ box_sizing: taffy::style::BoxSizing::ContentBox,
+ direction: taffy::style::Direction::Rtl,
+ grid_template_rows: vec![length(40f32), length(40f32), length(40f32)],
+ grid_template_columns: vec![length(40f32), length(40f32), length(40f32)],
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(120f32),
+ height: taffy::style::Dimension::from_length(120f32),
+ },
+ ..Default::default()
+ },
+ &[node0, node1, node2, node3, node4, node5, node6, node7, node8],
+ )
+ .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 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);
+ let layout = taffy.layout(node0).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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y);
+}
diff --git a/tests/generated/grid/grid_justify_content_end_direction_rtl.rs b/tests/generated/grid/grid_justify_content_end_direction_rtl.rs
new file mode 100644
index 000000000..12009f561
--- /dev/null
+++ b/tests/generated/grid/grid_justify_content_end_direction_rtl.rs
@@ -0,0 +1,214 @@
+#[test]
+#[allow(non_snake_case)]
+fn grid_justify_content_end_direction_rtl__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 node = taffy
+ .new_with_children(
+ taffy::style::Style {
+ display: taffy::style::Display::Grid,
+ direction: taffy::style::Direction::Rtl,
+ 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)],
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(200f32),
+ height: taffy::style::Dimension::from_length(200f32),
+ },
+ ..Default::default()
+ },
+ &[node0, node1, node2, node3, node4, node5, node6, node7, node8],
+ )
+ .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 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);
+ let layout = taffy.layout(node0).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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y);
+}
+
+#[test]
+#[allow(non_snake_case)]
+fn grid_justify_content_end_direction_rtl__content_box() {
+ #[allow(unused_imports)]
+ 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() })
+ .unwrap();
+ let node1 = taffy
+ .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() })
+ .unwrap();
+ let node2 = taffy
+ .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() })
+ .unwrap();
+ let node3 = taffy
+ .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() })
+ .unwrap();
+ let node4 = taffy
+ .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() })
+ .unwrap();
+ let node5 = taffy
+ .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() })
+ .unwrap();
+ let node6 = taffy
+ .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() })
+ .unwrap();
+ let node7 = taffy
+ .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() })
+ .unwrap();
+ let node8 = taffy
+ .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() })
+ .unwrap();
+ let node = taffy
+ .new_with_children(
+ taffy::style::Style {
+ display: taffy::style::Display::Grid,
+ box_sizing: taffy::style::BoxSizing::ContentBox,
+ direction: taffy::style::Direction::Rtl,
+ 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)],
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(200f32),
+ height: taffy::style::Dimension::from_length(200f32),
+ },
+ ..Default::default()
+ },
+ &[node0, node1, node2, node3, node4, node5, node6, node7, node8],
+ )
+ .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 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);
+ let layout = taffy.layout(node0).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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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);
+ 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, 80f32, "y of node {:?}. Expected {}. Actual {}", node8, 80f32, location.y);
+}
diff --git a/tests/generated/grid/grid_justify_content_start_direction_rtl.rs b/tests/generated/grid/grid_justify_content_start_direction_rtl.rs
new file mode 100644
index 000000000..3dc3361ca
--- /dev/null
+++ b/tests/generated/grid/grid_justify_content_start_direction_rtl.rs
@@ -0,0 +1,214 @@
+#[test]
+#[allow(non_snake_case)]
+fn grid_justify_content_start_direction_rtl__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 node = taffy
+ .new_with_children(
+ taffy::style::Style {
+ display: taffy::style::Display::Grid,
+ direction: taffy::style::Direction::Rtl,
+ 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)],
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(200f32),
+ height: taffy::style::Dimension::from_length(200f32),
+ },
+ ..Default::default()
+ },
+ &[node0, node1, node2, node3, node4, node5, node6, node7, node8],
+ )
+ .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 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);
+ let layout = taffy.layout(node0).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, 160f32, "x of node {:?}. Expected {}. Actual {}", node0, 160f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y);
+ 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);
+ 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);
+ 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, 160f32, "x of node {:?}. Expected {}. Actual {}", node3, 160f32, location.x);
+ assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y);
+ 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);
+ 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);
+ 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, 160f32, "x of node {:?}. Expected {}. Actual {}", node6, 160f32, location.x);
+ assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y);
+ 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);
+ 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);
+}
+
+#[test]
+#[allow(non_snake_case)]
+fn grid_justify_content_start_direction_rtl__content_box() {
+ #[allow(unused_imports)]
+ 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() })
+ .unwrap();
+ let node1 = taffy
+ .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() })
+ .unwrap();
+ let node2 = taffy
+ .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() })
+ .unwrap();
+ let node3 = taffy
+ .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() })
+ .unwrap();
+ let node4 = taffy
+ .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() })
+ .unwrap();
+ let node5 = taffy
+ .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() })
+ .unwrap();
+ let node6 = taffy
+ .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() })
+ .unwrap();
+ let node7 = taffy
+ .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() })
+ .unwrap();
+ let node8 = taffy
+ .new_leaf(taffy::style::Style { box_sizing: taffy::style::BoxSizing::ContentBox, ..Default::default() })
+ .unwrap();
+ let node = taffy
+ .new_with_children(
+ taffy::style::Style {
+ display: taffy::style::Display::Grid,
+ box_sizing: taffy::style::BoxSizing::ContentBox,
+ direction: taffy::style::Direction::Rtl,
+ 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)],
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(200f32),
+ height: taffy::style::Dimension::from_length(200f32),
+ },
+ ..Default::default()
+ },
+ &[node0, node1, node2, node3, node4, node5, node6, node7, node8],
+ )
+ .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 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);
+ let layout = taffy.layout(node0).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, 160f32, "x of node {:?}. Expected {}. Actual {}", node0, 160f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y);
+ 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);
+ 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);
+ 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, 160f32, "x of node {:?}. Expected {}. Actual {}", node3, 160f32, location.x);
+ assert_eq!(location.y, 40f32, "y of node {:?}. Expected {}. Actual {}", node3, 40f32, location.y);
+ 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);
+ 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);
+ 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, 160f32, "x of node {:?}. Expected {}. Actual {}", node6, 160f32, location.x);
+ assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node6, 80f32, location.y);
+ 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);
+ 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);
+}
diff --git a/tests/generated/grid/grid_justify_items_sized_end_direction_rtl.rs b/tests/generated/grid/grid_justify_items_sized_end_direction_rtl.rs
new file mode 100644
index 000000000..c3c0ba1d8
--- /dev/null
+++ b/tests/generated/grid/grid_justify_items_sized_end_direction_rtl.rs
@@ -0,0 +1,140 @@
+#[test]
+#[allow(non_snake_case)]
+fn grid_justify_items_sized_end_direction_rtl__border_box() {
+ #[allow(unused_imports)]
+ use taffy::{prelude::*, Layout};
+ let mut taffy = crate::new_test_tree();
+ let node0 = taffy
+ .new_leaf(taffy::style::Style {
+ grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto },
+ grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto },
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(20f32),
+ height: taffy::style::Dimension::from_length(20f32),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node1 = taffy
+ .new_leaf(taffy::style::Style {
+ 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 {
+ width: taffy::style::Dimension::from_length(20f32),
+ height: taffy::style::Dimension::from_length(20f32),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node = taffy
+ .new_with_children(
+ taffy::style::Style {
+ display: taffy::style::Display::Grid,
+ direction: taffy::style::Direction::Rtl,
+ 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)],
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(120f32),
+ height: taffy::style::Dimension::from_length(120f32),
+ },
+ ..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);
+ println!();
+ 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);
+ 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);
+ 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, 80f32, "y of node {:?}. Expected {}. Actual {}", node1, 80f32, location.y);
+}
+
+#[test]
+#[allow(non_snake_case)]
+fn grid_justify_items_sized_end_direction_rtl__content_box() {
+ #[allow(unused_imports)]
+ 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,
+ 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 {
+ width: taffy::style::Dimension::from_length(20f32),
+ height: taffy::style::Dimension::from_length(20f32),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node1 = taffy
+ .new_leaf(taffy::style::Style {
+ box_sizing: taffy::style::BoxSizing::ContentBox,
+ 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 {
+ width: taffy::style::Dimension::from_length(20f32),
+ height: taffy::style::Dimension::from_length(20f32),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node = taffy
+ .new_with_children(
+ taffy::style::Style {
+ display: taffy::style::Display::Grid,
+ box_sizing: taffy::style::BoxSizing::ContentBox,
+ direction: taffy::style::Direction::Rtl,
+ 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)],
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(120f32),
+ height: taffy::style::Dimension::from_length(120f32),
+ },
+ ..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);
+ println!();
+ 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);
+ 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);
+ 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, 80f32, "y of node {:?}. Expected {}. Actual {}", node1, 80f32, location.y);
+}
diff --git a/tests/generated/grid/grid_justify_items_sized_start_direction_rtl.rs b/tests/generated/grid/grid_justify_items_sized_start_direction_rtl.rs
new file mode 100644
index 000000000..78bb4c85b
--- /dev/null
+++ b/tests/generated/grid/grid_justify_items_sized_start_direction_rtl.rs
@@ -0,0 +1,140 @@
+#[test]
+#[allow(non_snake_case)]
+fn grid_justify_items_sized_start_direction_rtl__border_box() {
+ #[allow(unused_imports)]
+ use taffy::{prelude::*, Layout};
+ let mut taffy = crate::new_test_tree();
+ let node0 = taffy
+ .new_leaf(taffy::style::Style {
+ grid_row: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto },
+ grid_column: taffy::geometry::Line { start: line(1i16), end: taffy::style::GridPlacement::Auto },
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(20f32),
+ height: taffy::style::Dimension::from_length(20f32),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node1 = taffy
+ .new_leaf(taffy::style::Style {
+ 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 {
+ width: taffy::style::Dimension::from_length(20f32),
+ height: taffy::style::Dimension::from_length(20f32),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node = taffy
+ .new_with_children(
+ taffy::style::Style {
+ display: taffy::style::Display::Grid,
+ direction: taffy::style::Direction::Rtl,
+ 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)],
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(120f32),
+ height: taffy::style::Dimension::from_length(120f32),
+ },
+ ..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);
+ println!();
+ 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);
+ 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, 100f32, "x of node {:?}. Expected {}. Actual {}", node0, 100f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y);
+ 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, 20f32, "x of node {:?}. Expected {}. Actual {}", node1, 20f32, location.x);
+ assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node1, 80f32, location.y);
+}
+
+#[test]
+#[allow(non_snake_case)]
+fn grid_justify_items_sized_start_direction_rtl__content_box() {
+ #[allow(unused_imports)]
+ 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,
+ 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 {
+ width: taffy::style::Dimension::from_length(20f32),
+ height: taffy::style::Dimension::from_length(20f32),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node1 = taffy
+ .new_leaf(taffy::style::Style {
+ box_sizing: taffy::style::BoxSizing::ContentBox,
+ 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 {
+ width: taffy::style::Dimension::from_length(20f32),
+ height: taffy::style::Dimension::from_length(20f32),
+ },
+ ..Default::default()
+ })
+ .unwrap();
+ let node = taffy
+ .new_with_children(
+ taffy::style::Style {
+ display: taffy::style::Display::Grid,
+ box_sizing: taffy::style::BoxSizing::ContentBox,
+ direction: taffy::style::Direction::Rtl,
+ 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)],
+ size: taffy::geometry::Size {
+ width: taffy::style::Dimension::from_length(120f32),
+ height: taffy::style::Dimension::from_length(120f32),
+ },
+ ..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);
+ println!();
+ 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);
+ 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, 100f32, "x of node {:?}. Expected {}. Actual {}", node0, 100f32, location.x);
+ assert_eq!(location.y, 0f32, "y of node {:?}. Expected {}. Actual {}", node0, 0f32, location.y);
+ 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, 20f32, "x of node {:?}. Expected {}. Actual {}", node1, 20f32, location.x);
+ assert_eq!(location.y, 80f32, "y of node {:?}. Expected {}. Actual {}", node1, 80f32, location.y);
+}
diff --git a/tests/generated/grid/mod.rs b/tests/generated/grid/mod.rs
index 9583228e4..db5280c79 100644
--- a/tests/generated/grid/mod.rs
+++ b/tests/generated/grid/mod.rs
@@ -29,6 +29,8 @@ mod grid_absolute_container_top_right;
#[cfg(feature = "grid")]
mod grid_absolute_container_top_right_margin;
#[cfg(feature = "grid")]
+mod grid_absolute_direction_rtl;
+#[cfg(feature = "grid")]
mod grid_absolute_justify_self_sized_all;
#[cfg(feature = "grid")]
mod grid_absolute_layout_within_border;
@@ -181,6 +183,8 @@ mod grid_available_space_smaller_than_min_content;
#[cfg(feature = "grid")]
mod grid_basic;
#[cfg(feature = "grid")]
+mod grid_basic_direction_rtl;
+#[cfg(feature = "grid")]
mod grid_basic_implicit_tracks;
#[cfg(feature = "grid")]
mod grid_basic_with_overflow;
@@ -245,6 +249,8 @@ mod grid_justify_content_center_with_padding_border;
#[cfg(feature = "grid")]
mod grid_justify_content_end;
#[cfg(feature = "grid")]
+mod grid_justify_content_end_direction_rtl;
+#[cfg(feature = "grid")]
mod grid_justify_content_end_negative_space_gap;
#[cfg(feature = "grid")]
mod grid_justify_content_end_with_padding_border;
@@ -269,6 +275,8 @@ mod grid_justify_content_space_evenly_with_padding_border;
#[cfg(feature = "grid")]
mod grid_justify_content_start;
#[cfg(feature = "grid")]
+mod grid_justify_content_start_direction_rtl;
+#[cfg(feature = "grid")]
mod grid_justify_content_start_negative_space_gap;
#[cfg(feature = "grid")]
mod grid_justify_content_start_with_padding_border;
@@ -277,8 +285,12 @@ mod grid_justify_items_sized_center;
#[cfg(feature = "grid")]
mod grid_justify_items_sized_end;
#[cfg(feature = "grid")]
+mod grid_justify_items_sized_end_direction_rtl;
+#[cfg(feature = "grid")]
mod grid_justify_items_sized_start;
#[cfg(feature = "grid")]
+mod grid_justify_items_sized_start_direction_rtl;
+#[cfg(feature = "grid")]
mod grid_justify_items_sized_stretch;
#[cfg(feature = "grid")]
mod grid_justify_self_sized_all;