Fix row-reverse flex direction fixtures

Summary:
These tests were a bit weird for testing something with position. The gentest setup makes it so that the fixtures are wrapped in a absolutely positioned container with height and width bot 0. However, the generated yoga tests do NOT do this and instead have the root node as the fixture itself with no wrapping container.

This causes a problem when testing left/right/top/bottom position insets. Because left/right/top/bottom will position the element relative to its containing block when position is absolute, we will get different values on yoga and chrome even if the implementation is correct: https://developer.mozilla.org/en-US/docs/Web/CSS/right#description

To fix this, we just wrap the fixture in a set size div that is also absolutely positioned.

The file was also formatted.

Reviewed By: NickGerleman

Differential Revision: D50389229

fbshipit-source-id: ecd23939b973225cfb0611dc87f30c262952c5fc
This commit is contained in:
Joe Vilches
2023-10-18 17:30:18 -07:00
committed by Facebook GitHub Bot
parent f1f869b955
commit 2668e8e70c
4 changed files with 914 additions and 620 deletions

View File

@@ -1823,65 +1823,80 @@ test.skip('flex_direction_row_reverse_pos_left', () => {
try {
root = Yoga.Node.create(config);
root.setFlexDirection(FlexDirection.RowReverse);
root.setPosition(Edge.Left, 100);
root.setWidth(100);
root.setHeight(100);
const root_child0 = Yoga.Node.create(config);
root_child0.setWidth(10);
root_child0.setFlexDirection(FlexDirection.RowReverse);
root_child0.setPosition(Edge.Left, 100);
root_child0.setWidth(100);
root_child0.setHeight(100);
root.insertChild(root_child0, 0);
const root_child1 = Yoga.Node.create(config);
root_child1.setWidth(10);
root.insertChild(root_child1, 1);
const root_child0_child0 = Yoga.Node.create(config);
root_child0_child0.setWidth(10);
root_child0.insertChild(root_child0_child0, 0);
const root_child2 = Yoga.Node.create(config);
root_child2.setWidth(10);
root.insertChild(root_child2, 2);
const root_child0_child1 = Yoga.Node.create(config);
root_child0_child1.setWidth(10);
root_child0.insertChild(root_child0_child1, 1);
const root_child0_child2 = Yoga.Node.create(config);
root_child0_child2.setWidth(10);
root_child0.insertChild(root_child0_child2, 2);
root.calculateLayout(undefined, undefined, Direction.LTR);
expect(root.getComputedLeft()).toBe(100);
expect(root.getComputedLeft()).toBe(0);
expect(root.getComputedTop()).toBe(0);
expect(root.getComputedWidth()).toBe(100);
expect(root.getComputedHeight()).toBe(100);
expect(root_child0.getComputedLeft()).toBe(90);
expect(root_child0.getComputedLeft()).toBe(100);
expect(root_child0.getComputedTop()).toBe(0);
expect(root_child0.getComputedWidth()).toBe(10);
expect(root_child0.getComputedWidth()).toBe(100);
expect(root_child0.getComputedHeight()).toBe(100);
expect(root_child1.getComputedLeft()).toBe(80);
expect(root_child1.getComputedTop()).toBe(0);
expect(root_child1.getComputedWidth()).toBe(10);
expect(root_child1.getComputedHeight()).toBe(100);
expect(root_child0_child0.getComputedLeft()).toBe(90);
expect(root_child0_child0.getComputedTop()).toBe(0);
expect(root_child0_child0.getComputedWidth()).toBe(10);
expect(root_child0_child0.getComputedHeight()).toBe(100);
expect(root_child2.getComputedLeft()).toBe(70);
expect(root_child2.getComputedTop()).toBe(0);
expect(root_child2.getComputedWidth()).toBe(10);
expect(root_child2.getComputedHeight()).toBe(100);
expect(root_child0_child1.getComputedLeft()).toBe(80);
expect(root_child0_child1.getComputedTop()).toBe(0);
expect(root_child0_child1.getComputedWidth()).toBe(10);
expect(root_child0_child1.getComputedHeight()).toBe(100);
expect(root_child0_child2.getComputedLeft()).toBe(70);
expect(root_child0_child2.getComputedTop()).toBe(0);
expect(root_child0_child2.getComputedWidth()).toBe(10);
expect(root_child0_child2.getComputedHeight()).toBe(100);
root.calculateLayout(undefined, undefined, Direction.RTL);
expect(root.getComputedLeft()).toBe(100);
expect(root.getComputedLeft()).toBe(0);
expect(root.getComputedTop()).toBe(0);
expect(root.getComputedWidth()).toBe(100);
expect(root.getComputedHeight()).toBe(100);
expect(root_child0.getComputedLeft()).toBe(0);
expect(root_child0.getComputedLeft()).toBe(100);
expect(root_child0.getComputedTop()).toBe(0);
expect(root_child0.getComputedWidth()).toBe(10);
expect(root_child0.getComputedWidth()).toBe(100);
expect(root_child0.getComputedHeight()).toBe(100);
expect(root_child1.getComputedLeft()).toBe(10);
expect(root_child1.getComputedTop()).toBe(0);
expect(root_child1.getComputedWidth()).toBe(10);
expect(root_child1.getComputedHeight()).toBe(100);
expect(root_child0_child0.getComputedLeft()).toBe(0);
expect(root_child0_child0.getComputedTop()).toBe(0);
expect(root_child0_child0.getComputedWidth()).toBe(10);
expect(root_child0_child0.getComputedHeight()).toBe(100);
expect(root_child2.getComputedLeft()).toBe(20);
expect(root_child2.getComputedTop()).toBe(0);
expect(root_child2.getComputedWidth()).toBe(10);
expect(root_child2.getComputedHeight()).toBe(100);
expect(root_child0_child1.getComputedLeft()).toBe(10);
expect(root_child0_child1.getComputedTop()).toBe(0);
expect(root_child0_child1.getComputedWidth()).toBe(10);
expect(root_child0_child1.getComputedHeight()).toBe(100);
expect(root_child0_child2.getComputedLeft()).toBe(20);
expect(root_child0_child2.getComputedTop()).toBe(0);
expect(root_child0_child2.getComputedWidth()).toBe(10);
expect(root_child0_child2.getComputedHeight()).toBe(100);
} finally {
if (typeof root !== 'undefined') {
root.freeRecursive();
@@ -1890,7 +1905,7 @@ test.skip('flex_direction_row_reverse_pos_left', () => {
config.free();
}
});
test.skip('flex_direction_row_reverse_pos_start', () => {
test('flex_direction_row_reverse_pos_start', () => {
const config = Yoga.Config.create();
let root;
@@ -1898,65 +1913,80 @@ test.skip('flex_direction_row_reverse_pos_start', () => {
try {
root = Yoga.Node.create(config);
root.setFlexDirection(FlexDirection.RowReverse);
root.setPosition(Edge.Start, 100);
root.setWidth(100);
root.setHeight(100);
const root_child0 = Yoga.Node.create(config);
root_child0.setWidth(10);
root_child0.setFlexDirection(FlexDirection.RowReverse);
root_child0.setPosition(Edge.Start, 100);
root_child0.setWidth(100);
root_child0.setHeight(100);
root.insertChild(root_child0, 0);
const root_child1 = Yoga.Node.create(config);
root_child1.setWidth(10);
root.insertChild(root_child1, 1);
const root_child0_child0 = Yoga.Node.create(config);
root_child0_child0.setWidth(10);
root_child0.insertChild(root_child0_child0, 0);
const root_child2 = Yoga.Node.create(config);
root_child2.setWidth(10);
root.insertChild(root_child2, 2);
const root_child0_child1 = Yoga.Node.create(config);
root_child0_child1.setWidth(10);
root_child0.insertChild(root_child0_child1, 1);
const root_child0_child2 = Yoga.Node.create(config);
root_child0_child2.setWidth(10);
root_child0.insertChild(root_child0_child2, 2);
root.calculateLayout(undefined, undefined, Direction.LTR);
expect(root.getComputedLeft()).toBe(100);
expect(root.getComputedLeft()).toBe(0);
expect(root.getComputedTop()).toBe(0);
expect(root.getComputedWidth()).toBe(100);
expect(root.getComputedHeight()).toBe(100);
expect(root_child0.getComputedLeft()).toBe(90);
expect(root_child0.getComputedLeft()).toBe(100);
expect(root_child0.getComputedTop()).toBe(0);
expect(root_child0.getComputedWidth()).toBe(10);
expect(root_child0.getComputedWidth()).toBe(100);
expect(root_child0.getComputedHeight()).toBe(100);
expect(root_child1.getComputedLeft()).toBe(80);
expect(root_child1.getComputedTop()).toBe(0);
expect(root_child1.getComputedWidth()).toBe(10);
expect(root_child1.getComputedHeight()).toBe(100);
expect(root_child0_child0.getComputedLeft()).toBe(90);
expect(root_child0_child0.getComputedTop()).toBe(0);
expect(root_child0_child0.getComputedWidth()).toBe(10);
expect(root_child0_child0.getComputedHeight()).toBe(100);
expect(root_child2.getComputedLeft()).toBe(70);
expect(root_child2.getComputedTop()).toBe(0);
expect(root_child2.getComputedWidth()).toBe(10);
expect(root_child2.getComputedHeight()).toBe(100);
expect(root_child0_child1.getComputedLeft()).toBe(80);
expect(root_child0_child1.getComputedTop()).toBe(0);
expect(root_child0_child1.getComputedWidth()).toBe(10);
expect(root_child0_child1.getComputedHeight()).toBe(100);
expect(root_child0_child2.getComputedLeft()).toBe(70);
expect(root_child0_child2.getComputedTop()).toBe(0);
expect(root_child0_child2.getComputedWidth()).toBe(10);
expect(root_child0_child2.getComputedHeight()).toBe(100);
root.calculateLayout(undefined, undefined, Direction.RTL);
expect(root.getComputedLeft()).toBe(-200);
expect(root.getComputedLeft()).toBe(0);
expect(root.getComputedTop()).toBe(0);
expect(root.getComputedWidth()).toBe(100);
expect(root.getComputedHeight()).toBe(100);
expect(root_child0.getComputedLeft()).toBe(0);
expect(root_child0.getComputedLeft()).toBe(-100);
expect(root_child0.getComputedTop()).toBe(0);
expect(root_child0.getComputedWidth()).toBe(10);
expect(root_child0.getComputedWidth()).toBe(100);
expect(root_child0.getComputedHeight()).toBe(100);
expect(root_child1.getComputedLeft()).toBe(10);
expect(root_child1.getComputedTop()).toBe(0);
expect(root_child1.getComputedWidth()).toBe(10);
expect(root_child1.getComputedHeight()).toBe(100);
expect(root_child0_child0.getComputedLeft()).toBe(0);
expect(root_child0_child0.getComputedTop()).toBe(0);
expect(root_child0_child0.getComputedWidth()).toBe(10);
expect(root_child0_child0.getComputedHeight()).toBe(100);
expect(root_child2.getComputedLeft()).toBe(20);
expect(root_child2.getComputedTop()).toBe(0);
expect(root_child2.getComputedWidth()).toBe(10);
expect(root_child2.getComputedHeight()).toBe(100);
expect(root_child0_child1.getComputedLeft()).toBe(10);
expect(root_child0_child1.getComputedTop()).toBe(0);
expect(root_child0_child1.getComputedWidth()).toBe(10);
expect(root_child0_child1.getComputedHeight()).toBe(100);
expect(root_child0_child2.getComputedLeft()).toBe(20);
expect(root_child0_child2.getComputedTop()).toBe(0);
expect(root_child0_child2.getComputedWidth()).toBe(10);
expect(root_child0_child2.getComputedHeight()).toBe(100);
} finally {
if (typeof root !== 'undefined') {
root.freeRecursive();
@@ -1973,65 +2003,80 @@ test.skip('flex_direction_row_reverse_pos_right', () => {
try {
root = Yoga.Node.create(config);
root.setFlexDirection(FlexDirection.RowReverse);
root.setPosition(Edge.Right, 100);
root.setWidth(100);
root.setHeight(100);
const root_child0 = Yoga.Node.create(config);
root_child0.setWidth(10);
root_child0.setFlexDirection(FlexDirection.RowReverse);
root_child0.setPosition(Edge.Right, 100);
root_child0.setWidth(100);
root_child0.setHeight(100);
root.insertChild(root_child0, 0);
const root_child1 = Yoga.Node.create(config);
root_child1.setWidth(10);
root.insertChild(root_child1, 1);
const root_child0_child0 = Yoga.Node.create(config);
root_child0_child0.setWidth(10);
root_child0.insertChild(root_child0_child0, 0);
const root_child2 = Yoga.Node.create(config);
root_child2.setWidth(10);
root.insertChild(root_child2, 2);
const root_child0_child1 = Yoga.Node.create(config);
root_child0_child1.setWidth(10);
root_child0.insertChild(root_child0_child1, 1);
const root_child0_child2 = Yoga.Node.create(config);
root_child0_child2.setWidth(10);
root_child0.insertChild(root_child0_child2, 2);
root.calculateLayout(undefined, undefined, Direction.LTR);
expect(root.getComputedLeft()).toBe(-200);
expect(root.getComputedLeft()).toBe(0);
expect(root.getComputedTop()).toBe(0);
expect(root.getComputedWidth()).toBe(100);
expect(root.getComputedHeight()).toBe(100);
expect(root_child0.getComputedLeft()).toBe(90);
expect(root_child0.getComputedLeft()).toBe(-100);
expect(root_child0.getComputedTop()).toBe(0);
expect(root_child0.getComputedWidth()).toBe(10);
expect(root_child0.getComputedWidth()).toBe(100);
expect(root_child0.getComputedHeight()).toBe(100);
expect(root_child1.getComputedLeft()).toBe(80);
expect(root_child1.getComputedTop()).toBe(0);
expect(root_child1.getComputedWidth()).toBe(10);
expect(root_child1.getComputedHeight()).toBe(100);
expect(root_child0_child0.getComputedLeft()).toBe(90);
expect(root_child0_child0.getComputedTop()).toBe(0);
expect(root_child0_child0.getComputedWidth()).toBe(10);
expect(root_child0_child0.getComputedHeight()).toBe(100);
expect(root_child2.getComputedLeft()).toBe(70);
expect(root_child2.getComputedTop()).toBe(0);
expect(root_child2.getComputedWidth()).toBe(10);
expect(root_child2.getComputedHeight()).toBe(100);
expect(root_child0_child1.getComputedLeft()).toBe(80);
expect(root_child0_child1.getComputedTop()).toBe(0);
expect(root_child0_child1.getComputedWidth()).toBe(10);
expect(root_child0_child1.getComputedHeight()).toBe(100);
expect(root_child0_child2.getComputedLeft()).toBe(70);
expect(root_child0_child2.getComputedTop()).toBe(0);
expect(root_child0_child2.getComputedWidth()).toBe(10);
expect(root_child0_child2.getComputedHeight()).toBe(100);
root.calculateLayout(undefined, undefined, Direction.RTL);
expect(root.getComputedLeft()).toBe(-200);
expect(root.getComputedLeft()).toBe(0);
expect(root.getComputedTop()).toBe(0);
expect(root.getComputedWidth()).toBe(100);
expect(root.getComputedHeight()).toBe(100);
expect(root_child0.getComputedLeft()).toBe(0);
expect(root_child0.getComputedLeft()).toBe(-100);
expect(root_child0.getComputedTop()).toBe(0);
expect(root_child0.getComputedWidth()).toBe(10);
expect(root_child0.getComputedWidth()).toBe(100);
expect(root_child0.getComputedHeight()).toBe(100);
expect(root_child1.getComputedLeft()).toBe(10);
expect(root_child1.getComputedTop()).toBe(0);
expect(root_child1.getComputedWidth()).toBe(10);
expect(root_child1.getComputedHeight()).toBe(100);
expect(root_child0_child0.getComputedLeft()).toBe(0);
expect(root_child0_child0.getComputedTop()).toBe(0);
expect(root_child0_child0.getComputedWidth()).toBe(10);
expect(root_child0_child0.getComputedHeight()).toBe(100);
expect(root_child2.getComputedLeft()).toBe(20);
expect(root_child2.getComputedTop()).toBe(0);
expect(root_child2.getComputedWidth()).toBe(10);
expect(root_child2.getComputedHeight()).toBe(100);
expect(root_child0_child1.getComputedLeft()).toBe(10);
expect(root_child0_child1.getComputedTop()).toBe(0);
expect(root_child0_child1.getComputedWidth()).toBe(10);
expect(root_child0_child1.getComputedHeight()).toBe(100);
expect(root_child0_child2.getComputedLeft()).toBe(20);
expect(root_child0_child2.getComputedTop()).toBe(0);
expect(root_child0_child2.getComputedWidth()).toBe(10);
expect(root_child0_child2.getComputedHeight()).toBe(100);
} finally {
if (typeof root !== 'undefined') {
root.freeRecursive();
@@ -2040,7 +2085,7 @@ test.skip('flex_direction_row_reverse_pos_right', () => {
config.free();
}
});
test.skip('flex_direction_row_reverse_pos_end', () => {
test('flex_direction_row_reverse_pos_end', () => {
const config = Yoga.Config.create();
let root;
@@ -2048,65 +2093,80 @@ test.skip('flex_direction_row_reverse_pos_end', () => {
try {
root = Yoga.Node.create(config);
root.setFlexDirection(FlexDirection.RowReverse);
root.setPosition(Edge.End, 100);
root.setWidth(100);
root.setHeight(100);
const root_child0 = Yoga.Node.create(config);
root_child0.setWidth(10);
root_child0.setFlexDirection(FlexDirection.RowReverse);
root_child0.setPosition(Edge.End, 100);
root_child0.setWidth(100);
root_child0.setHeight(100);
root.insertChild(root_child0, 0);
const root_child1 = Yoga.Node.create(config);
root_child1.setWidth(10);
root.insertChild(root_child1, 1);
const root_child0_child0 = Yoga.Node.create(config);
root_child0_child0.setWidth(10);
root_child0.insertChild(root_child0_child0, 0);
const root_child2 = Yoga.Node.create(config);
root_child2.setWidth(10);
root.insertChild(root_child2, 2);
const root_child0_child1 = Yoga.Node.create(config);
root_child0_child1.setWidth(10);
root_child0.insertChild(root_child0_child1, 1);
const root_child0_child2 = Yoga.Node.create(config);
root_child0_child2.setWidth(10);
root_child0.insertChild(root_child0_child2, 2);
root.calculateLayout(undefined, undefined, Direction.LTR);
expect(root.getComputedLeft()).toBe(-200);
expect(root.getComputedLeft()).toBe(0);
expect(root.getComputedTop()).toBe(0);
expect(root.getComputedWidth()).toBe(100);
expect(root.getComputedHeight()).toBe(100);
expect(root_child0.getComputedLeft()).toBe(90);
expect(root_child0.getComputedLeft()).toBe(-100);
expect(root_child0.getComputedTop()).toBe(0);
expect(root_child0.getComputedWidth()).toBe(10);
expect(root_child0.getComputedWidth()).toBe(100);
expect(root_child0.getComputedHeight()).toBe(100);
expect(root_child1.getComputedLeft()).toBe(80);
expect(root_child1.getComputedTop()).toBe(0);
expect(root_child1.getComputedWidth()).toBe(10);
expect(root_child1.getComputedHeight()).toBe(100);
expect(root_child0_child0.getComputedLeft()).toBe(90);
expect(root_child0_child0.getComputedTop()).toBe(0);
expect(root_child0_child0.getComputedWidth()).toBe(10);
expect(root_child0_child0.getComputedHeight()).toBe(100);
expect(root_child2.getComputedLeft()).toBe(70);
expect(root_child2.getComputedTop()).toBe(0);
expect(root_child2.getComputedWidth()).toBe(10);
expect(root_child2.getComputedHeight()).toBe(100);
expect(root_child0_child1.getComputedLeft()).toBe(80);
expect(root_child0_child1.getComputedTop()).toBe(0);
expect(root_child0_child1.getComputedWidth()).toBe(10);
expect(root_child0_child1.getComputedHeight()).toBe(100);
expect(root_child0_child2.getComputedLeft()).toBe(70);
expect(root_child0_child2.getComputedTop()).toBe(0);
expect(root_child0_child2.getComputedWidth()).toBe(10);
expect(root_child0_child2.getComputedHeight()).toBe(100);
root.calculateLayout(undefined, undefined, Direction.RTL);
expect(root.getComputedLeft()).toBe(100);
expect(root.getComputedLeft()).toBe(0);
expect(root.getComputedTop()).toBe(0);
expect(root.getComputedWidth()).toBe(100);
expect(root.getComputedHeight()).toBe(100);
expect(root_child0.getComputedLeft()).toBe(0);
expect(root_child0.getComputedLeft()).toBe(100);
expect(root_child0.getComputedTop()).toBe(0);
expect(root_child0.getComputedWidth()).toBe(10);
expect(root_child0.getComputedWidth()).toBe(100);
expect(root_child0.getComputedHeight()).toBe(100);
expect(root_child1.getComputedLeft()).toBe(10);
expect(root_child1.getComputedTop()).toBe(0);
expect(root_child1.getComputedWidth()).toBe(10);
expect(root_child1.getComputedHeight()).toBe(100);
expect(root_child0_child0.getComputedLeft()).toBe(0);
expect(root_child0_child0.getComputedTop()).toBe(0);
expect(root_child0_child0.getComputedWidth()).toBe(10);
expect(root_child0_child0.getComputedHeight()).toBe(100);
expect(root_child2.getComputedLeft()).toBe(20);
expect(root_child2.getComputedTop()).toBe(0);
expect(root_child2.getComputedWidth()).toBe(10);
expect(root_child2.getComputedHeight()).toBe(100);
expect(root_child0_child1.getComputedLeft()).toBe(10);
expect(root_child0_child1.getComputedTop()).toBe(0);
expect(root_child0_child1.getComputedWidth()).toBe(10);
expect(root_child0_child1.getComputedHeight()).toBe(100);
expect(root_child0_child2.getComputedLeft()).toBe(20);
expect(root_child0_child2.getComputedTop()).toBe(0);
expect(root_child0_child2.getComputedWidth()).toBe(10);
expect(root_child0_child2.getComputedHeight()).toBe(100);
} finally {
if (typeof root !== 'undefined') {
root.freeRecursive();
@@ -2123,65 +2183,80 @@ test.skip('flex_direction_column_reverse_pos_top', () => {
try {
root = Yoga.Node.create(config);
root.setFlexDirection(FlexDirection.ColumnReverse);
root.setPosition(Edge.Top, 100);
root.setWidth(100);
root.setHeight(100);
const root_child0 = Yoga.Node.create(config);
root_child0.setWidth(10);
root_child0.setFlexDirection(FlexDirection.ColumnReverse);
root_child0.setPosition(Edge.Top, 100);
root_child0.setWidth(100);
root_child0.setHeight(100);
root.insertChild(root_child0, 0);
const root_child1 = Yoga.Node.create(config);
root_child1.setWidth(10);
root.insertChild(root_child1, 1);
const root_child0_child0 = Yoga.Node.create(config);
root_child0_child0.setWidth(10);
root_child0.insertChild(root_child0_child0, 0);
const root_child2 = Yoga.Node.create(config);
root_child2.setWidth(10);
root.insertChild(root_child2, 2);
const root_child0_child1 = Yoga.Node.create(config);
root_child0_child1.setWidth(10);
root_child0.insertChild(root_child0_child1, 1);
const root_child0_child2 = Yoga.Node.create(config);
root_child0_child2.setWidth(10);
root_child0.insertChild(root_child0_child2, 2);
root.calculateLayout(undefined, undefined, Direction.LTR);
expect(root.getComputedLeft()).toBe(0);
expect(root.getComputedTop()).toBe(100);
expect(root.getComputedTop()).toBe(0);
expect(root.getComputedWidth()).toBe(100);
expect(root.getComputedHeight()).toBe(100);
expect(root_child0.getComputedLeft()).toBe(0);
expect(root_child0.getComputedTop()).toBe(100);
expect(root_child0.getComputedWidth()).toBe(10);
expect(root_child0.getComputedHeight()).toBe(0);
expect(root_child0.getComputedWidth()).toBe(100);
expect(root_child0.getComputedHeight()).toBe(100);
expect(root_child1.getComputedLeft()).toBe(0);
expect(root_child1.getComputedTop()).toBe(100);
expect(root_child1.getComputedWidth()).toBe(10);
expect(root_child1.getComputedHeight()).toBe(0);
expect(root_child0_child0.getComputedLeft()).toBe(0);
expect(root_child0_child0.getComputedTop()).toBe(100);
expect(root_child0_child0.getComputedWidth()).toBe(10);
expect(root_child0_child0.getComputedHeight()).toBe(0);
expect(root_child2.getComputedLeft()).toBe(0);
expect(root_child2.getComputedTop()).toBe(100);
expect(root_child2.getComputedWidth()).toBe(10);
expect(root_child2.getComputedHeight()).toBe(0);
expect(root_child0_child1.getComputedLeft()).toBe(0);
expect(root_child0_child1.getComputedTop()).toBe(100);
expect(root_child0_child1.getComputedWidth()).toBe(10);
expect(root_child0_child1.getComputedHeight()).toBe(0);
expect(root_child0_child2.getComputedLeft()).toBe(0);
expect(root_child0_child2.getComputedTop()).toBe(100);
expect(root_child0_child2.getComputedWidth()).toBe(10);
expect(root_child0_child2.getComputedHeight()).toBe(0);
root.calculateLayout(undefined, undefined, Direction.RTL);
expect(root.getComputedLeft()).toBe(0);
expect(root.getComputedTop()).toBe(100);
expect(root.getComputedTop()).toBe(0);
expect(root.getComputedWidth()).toBe(100);
expect(root.getComputedHeight()).toBe(100);
expect(root_child0.getComputedLeft()).toBe(90);
expect(root_child0.getComputedLeft()).toBe(0);
expect(root_child0.getComputedTop()).toBe(100);
expect(root_child0.getComputedWidth()).toBe(10);
expect(root_child0.getComputedHeight()).toBe(0);
expect(root_child0.getComputedWidth()).toBe(100);
expect(root_child0.getComputedHeight()).toBe(100);
expect(root_child1.getComputedLeft()).toBe(90);
expect(root_child1.getComputedTop()).toBe(100);
expect(root_child1.getComputedWidth()).toBe(10);
expect(root_child1.getComputedHeight()).toBe(0);
expect(root_child0_child0.getComputedLeft()).toBe(90);
expect(root_child0_child0.getComputedTop()).toBe(100);
expect(root_child0_child0.getComputedWidth()).toBe(10);
expect(root_child0_child0.getComputedHeight()).toBe(0);
expect(root_child2.getComputedLeft()).toBe(90);
expect(root_child2.getComputedTop()).toBe(100);
expect(root_child2.getComputedWidth()).toBe(10);
expect(root_child2.getComputedHeight()).toBe(0);
expect(root_child0_child1.getComputedLeft()).toBe(90);
expect(root_child0_child1.getComputedTop()).toBe(100);
expect(root_child0_child1.getComputedWidth()).toBe(10);
expect(root_child0_child1.getComputedHeight()).toBe(0);
expect(root_child0_child2.getComputedLeft()).toBe(90);
expect(root_child0_child2.getComputedTop()).toBe(100);
expect(root_child0_child2.getComputedWidth()).toBe(10);
expect(root_child0_child2.getComputedHeight()).toBe(0);
} finally {
if (typeof root !== 'undefined') {
root.freeRecursive();
@@ -2198,65 +2273,80 @@ test.skip('flex_direction_column_reverse_pos_bottom', () => {
try {
root = Yoga.Node.create(config);
root.setFlexDirection(FlexDirection.ColumnReverse);
root.setPosition(Edge.Bottom, 100);
root.setWidth(100);
root.setHeight(100);
const root_child0 = Yoga.Node.create(config);
root_child0.setWidth(10);
root_child0.setFlexDirection(FlexDirection.ColumnReverse);
root_child0.setPosition(Edge.Bottom, 100);
root_child0.setWidth(100);
root_child0.setHeight(100);
root.insertChild(root_child0, 0);
const root_child1 = Yoga.Node.create(config);
root_child1.setWidth(10);
root.insertChild(root_child1, 1);
const root_child0_child0 = Yoga.Node.create(config);
root_child0_child0.setWidth(10);
root_child0.insertChild(root_child0_child0, 0);
const root_child2 = Yoga.Node.create(config);
root_child2.setWidth(10);
root.insertChild(root_child2, 2);
const root_child0_child1 = Yoga.Node.create(config);
root_child0_child1.setWidth(10);
root_child0.insertChild(root_child0_child1, 1);
const root_child0_child2 = Yoga.Node.create(config);
root_child0_child2.setWidth(10);
root_child0.insertChild(root_child0_child2, 2);
root.calculateLayout(undefined, undefined, Direction.LTR);
expect(root.getComputedLeft()).toBe(0);
expect(root.getComputedTop()).toBe(-200);
expect(root.getComputedTop()).toBe(0);
expect(root.getComputedWidth()).toBe(100);
expect(root.getComputedHeight()).toBe(100);
expect(root_child0.getComputedLeft()).toBe(0);
expect(root_child0.getComputedTop()).toBe(100);
expect(root_child0.getComputedWidth()).toBe(10);
expect(root_child0.getComputedHeight()).toBe(0);
expect(root_child0.getComputedTop()).toBe(-100);
expect(root_child0.getComputedWidth()).toBe(100);
expect(root_child0.getComputedHeight()).toBe(100);
expect(root_child1.getComputedLeft()).toBe(0);
expect(root_child1.getComputedTop()).toBe(100);
expect(root_child1.getComputedWidth()).toBe(10);
expect(root_child1.getComputedHeight()).toBe(0);
expect(root_child0_child0.getComputedLeft()).toBe(0);
expect(root_child0_child0.getComputedTop()).toBe(100);
expect(root_child0_child0.getComputedWidth()).toBe(10);
expect(root_child0_child0.getComputedHeight()).toBe(0);
expect(root_child2.getComputedLeft()).toBe(0);
expect(root_child2.getComputedTop()).toBe(100);
expect(root_child2.getComputedWidth()).toBe(10);
expect(root_child2.getComputedHeight()).toBe(0);
expect(root_child0_child1.getComputedLeft()).toBe(0);
expect(root_child0_child1.getComputedTop()).toBe(100);
expect(root_child0_child1.getComputedWidth()).toBe(10);
expect(root_child0_child1.getComputedHeight()).toBe(0);
expect(root_child0_child2.getComputedLeft()).toBe(0);
expect(root_child0_child2.getComputedTop()).toBe(100);
expect(root_child0_child2.getComputedWidth()).toBe(10);
expect(root_child0_child2.getComputedHeight()).toBe(0);
root.calculateLayout(undefined, undefined, Direction.RTL);
expect(root.getComputedLeft()).toBe(0);
expect(root.getComputedTop()).toBe(-200);
expect(root.getComputedTop()).toBe(0);
expect(root.getComputedWidth()).toBe(100);
expect(root.getComputedHeight()).toBe(100);
expect(root_child0.getComputedLeft()).toBe(90);
expect(root_child0.getComputedTop()).toBe(100);
expect(root_child0.getComputedWidth()).toBe(10);
expect(root_child0.getComputedHeight()).toBe(0);
expect(root_child0.getComputedLeft()).toBe(0);
expect(root_child0.getComputedTop()).toBe(-100);
expect(root_child0.getComputedWidth()).toBe(100);
expect(root_child0.getComputedHeight()).toBe(100);
expect(root_child1.getComputedLeft()).toBe(90);
expect(root_child1.getComputedTop()).toBe(100);
expect(root_child1.getComputedWidth()).toBe(10);
expect(root_child1.getComputedHeight()).toBe(0);
expect(root_child0_child0.getComputedLeft()).toBe(90);
expect(root_child0_child0.getComputedTop()).toBe(100);
expect(root_child0_child0.getComputedWidth()).toBe(10);
expect(root_child0_child0.getComputedHeight()).toBe(0);
expect(root_child2.getComputedLeft()).toBe(90);
expect(root_child2.getComputedTop()).toBe(100);
expect(root_child2.getComputedWidth()).toBe(10);
expect(root_child2.getComputedHeight()).toBe(0);
expect(root_child0_child1.getComputedLeft()).toBe(90);
expect(root_child0_child1.getComputedTop()).toBe(100);
expect(root_child0_child1.getComputedWidth()).toBe(10);
expect(root_child0_child1.getComputedHeight()).toBe(0);
expect(root_child0_child2.getComputedLeft()).toBe(90);
expect(root_child0_child2.getComputedTop()).toBe(100);
expect(root_child0_child2.getComputedWidth()).toBe(10);
expect(root_child0_child2.getComputedHeight()).toBe(0);
} finally {
if (typeof root !== 'undefined') {
root.freeRecursive();