Add some tests for justification under row-reverse (#1560)
Summary: Pull Request resolved: https://github.com/facebook/yoga/pull/1560 I added these when I was trying to debug the Facepile break removing the row-reverse errata caused. Yoga is doing the right thing, and the tests pass. We didn't have this specific coverage before, so add it. Reviewed By: joevilches Differential Revision: D52909633 fbshipit-source-id: d1e8f55bb534d76bd7dfdc46a1e1cc6f0a3ca211
This commit is contained in:
committed by
Facebook GitHub Bot
parent
8744792f41
commit
395c596695
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<1bf27853929efafcaddd97d42631623a>>
|
||||
* @generated SignedSource<<22142a9aaf328ac001ca4629e6c12f87>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGJustifyContentTest.html
|
||||
*/
|
||||
|
||||
@@ -1334,3 +1334,149 @@ test('justify_content_space_between_indefinite_container_dim_with_free_space', (
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test('justify_content_flex_start_row_reverse', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.RowReverse);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setWidth(20);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setWidth(20);
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setWidth(20);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
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(80);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(20);
|
||||
expect(root_child0.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child1.getComputedLeft()).toBe(60);
|
||||
expect(root_child1.getComputedTop()).toBe(0);
|
||||
expect(root_child1.getComputedWidth()).toBe(20);
|
||||
expect(root_child1.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child2.getComputedLeft()).toBe(40);
|
||||
expect(root_child2.getComputedTop()).toBe(0);
|
||||
expect(root_child2.getComputedWidth()).toBe(20);
|
||||
expect(root_child2.getComputedHeight()).toBe(100);
|
||||
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
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.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(20);
|
||||
expect(root_child0.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child1.getComputedLeft()).toBe(20);
|
||||
expect(root_child1.getComputedTop()).toBe(0);
|
||||
expect(root_child1.getComputedWidth()).toBe(20);
|
||||
expect(root_child1.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child2.getComputedLeft()).toBe(40);
|
||||
expect(root_child2.getComputedTop()).toBe(0);
|
||||
expect(root_child2.getComputedWidth()).toBe(20);
|
||||
expect(root_child2.getComputedHeight()).toBe(100);
|
||||
} finally {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test('justify_content_flex_end_row_reverse', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.RowReverse);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setWidth(20);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setWidth(20);
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setWidth(20);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
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(80);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(20);
|
||||
expect(root_child0.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child1.getComputedLeft()).toBe(60);
|
||||
expect(root_child1.getComputedTop()).toBe(0);
|
||||
expect(root_child1.getComputedWidth()).toBe(20);
|
||||
expect(root_child1.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child2.getComputedLeft()).toBe(40);
|
||||
expect(root_child2.getComputedTop()).toBe(0);
|
||||
expect(root_child2.getComputedWidth()).toBe(20);
|
||||
expect(root_child2.getComputedHeight()).toBe(100);
|
||||
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
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.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(20);
|
||||
expect(root_child0.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child1.getComputedLeft()).toBe(20);
|
||||
expect(root_child1.getComputedTop()).toBe(0);
|
||||
expect(root_child1.getComputedWidth()).toBe(20);
|
||||
expect(root_child1.getComputedHeight()).toBe(100);
|
||||
|
||||
expect(root_child2.getComputedLeft()).toBe(40);
|
||||
expect(root_child2.getComputedTop()).toBe(0);
|
||||
expect(root_child2.getComputedWidth()).toBe(20);
|
||||
expect(root_child2.getComputedHeight()).toBe(100);
|
||||
} finally {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user