gentest support for position: static + initial test
Summary: I am about to embark on supporting `position: static` in Yoga. The enum exists already (and is the default position type, lol) but does not actually do anything and just behaves like `position: relative`. My approach here is to write a bunch of tests to test for the various behaviors of static positions and then develop on Yoga afterwards to get those tests passing. To do this, we need to make a few changes to the gentest files as there is not support for adding `position: static` at the moment: * Make it so that the gentest code can physically write `YGPositionTypeStatic` if it encounters `position: static` in the style * Make it so that gentest.js knows that Yoga's default is actually static. This way the code generated in the tests will actually label nodes for non default values * Explicitly label the position type even when it is not declared in the style prop (with the exception of the default) * Regenerate all the tests Additionally I added the first, basic test: making sure insets do nothing on a statically positioned element. Reviewed By: NickGerleman Differential Revision: D50437855 fbshipit-source-id: 0e8bbf1c224d477ea4592b7563d0b70d2ffa79c8
This commit is contained in:
committed by
Facebook GitHub Bot
parent
7e91004b90
commit
2ea4c043fd
@@ -34,24 +34,28 @@ test('column_gap_flexible', () => {
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(80);
|
||||
root.setHeight(100);
|
||||
root.setGap(Gutter.Column, 10);
|
||||
root.setGap(Gutter.Row, 20);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setFlexGrow(1);
|
||||
root_child0.setFlexShrink(1);
|
||||
root_child0.setFlexBasis("0%");
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setFlexGrow(1);
|
||||
root_child1.setFlexShrink(1);
|
||||
root_child1.setFlexBasis("0%");
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setPositionType(PositionType.Relative);
|
||||
root_child2.setFlexGrow(1);
|
||||
root_child2.setFlexShrink(1);
|
||||
root_child2.setFlexBasis("0%");
|
||||
@@ -116,19 +120,23 @@ test('column_gap_inflexible', () => {
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(80);
|
||||
root.setHeight(100);
|
||||
root.setGap(Gutter.Column, 10);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setWidth(20);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setWidth(20);
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setPositionType(PositionType.Relative);
|
||||
root_child2.setWidth(20);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
@@ -191,21 +199,25 @@ test('column_gap_mixed_flexible', () => {
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(80);
|
||||
root.setHeight(100);
|
||||
root.setGap(Gutter.Column, 10);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setWidth(20);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setFlexGrow(1);
|
||||
root_child1.setFlexShrink(1);
|
||||
root_child1.setFlexBasis("0%");
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setPositionType(PositionType.Relative);
|
||||
root_child2.setWidth(20);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
@@ -268,11 +280,13 @@ test('column_gap_child_margins', () => {
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(80);
|
||||
root.setHeight(100);
|
||||
root.setGap(Gutter.Column, 10);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setFlexGrow(1);
|
||||
root_child0.setFlexShrink(1);
|
||||
root_child0.setFlexBasis("0%");
|
||||
@@ -281,6 +295,7 @@ test('column_gap_child_margins', () => {
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setFlexGrow(1);
|
||||
root_child1.setFlexShrink(1);
|
||||
root_child1.setFlexBasis("0%");
|
||||
@@ -289,6 +304,7 @@ test('column_gap_child_margins', () => {
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setPositionType(PositionType.Relative);
|
||||
root_child2.setFlexGrow(1);
|
||||
root_child2.setFlexShrink(1);
|
||||
root_child2.setFlexBasis("0%");
|
||||
@@ -355,52 +371,62 @@ test('column_row_gap_wrapping', () => {
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setFlexWrap(Wrap.Wrap);
|
||||
root.setWidth(80);
|
||||
root.setGap(Gutter.Column, 10);
|
||||
root.setGap(Gutter.Row, 20);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setWidth(20);
|
||||
root_child0.setHeight(20);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setWidth(20);
|
||||
root_child1.setHeight(20);
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setPositionType(PositionType.Relative);
|
||||
root_child2.setWidth(20);
|
||||
root_child2.setHeight(20);
|
||||
root.insertChild(root_child2, 2);
|
||||
|
||||
const root_child3 = Yoga.Node.create(config);
|
||||
root_child3.setPositionType(PositionType.Relative);
|
||||
root_child3.setWidth(20);
|
||||
root_child3.setHeight(20);
|
||||
root.insertChild(root_child3, 3);
|
||||
|
||||
const root_child4 = Yoga.Node.create(config);
|
||||
root_child4.setPositionType(PositionType.Relative);
|
||||
root_child4.setWidth(20);
|
||||
root_child4.setHeight(20);
|
||||
root.insertChild(root_child4, 4);
|
||||
|
||||
const root_child5 = Yoga.Node.create(config);
|
||||
root_child5.setPositionType(PositionType.Relative);
|
||||
root_child5.setWidth(20);
|
||||
root_child5.setHeight(20);
|
||||
root.insertChild(root_child5, 5);
|
||||
|
||||
const root_child6 = Yoga.Node.create(config);
|
||||
root_child6.setPositionType(PositionType.Relative);
|
||||
root_child6.setWidth(20);
|
||||
root_child6.setHeight(20);
|
||||
root.insertChild(root_child6, 6);
|
||||
|
||||
const root_child7 = Yoga.Node.create(config);
|
||||
root_child7.setPositionType(PositionType.Relative);
|
||||
root_child7.setWidth(20);
|
||||
root_child7.setHeight(20);
|
||||
root.insertChild(root_child7, 7);
|
||||
|
||||
const root_child8 = Yoga.Node.create(config);
|
||||
root_child8.setPositionType(PositionType.Relative);
|
||||
root_child8.setWidth(20);
|
||||
root_child8.setHeight(20);
|
||||
root.insertChild(root_child8, 8);
|
||||
@@ -524,6 +550,7 @@ test('column_gap_start_index', () => {
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setFlexWrap(Wrap.Wrap);
|
||||
root.setWidth(80);
|
||||
root.setGap(Gutter.Column, 10);
|
||||
@@ -536,16 +563,19 @@ test('column_gap_start_index', () => {
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setWidth(20);
|
||||
root_child1.setHeight(20);
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setPositionType(PositionType.Relative);
|
||||
root_child2.setWidth(20);
|
||||
root_child2.setHeight(20);
|
||||
root.insertChild(root_child2, 2);
|
||||
|
||||
const root_child3 = Yoga.Node.create(config);
|
||||
root_child3.setPositionType(PositionType.Relative);
|
||||
root_child3.setWidth(20);
|
||||
root_child3.setHeight(20);
|
||||
root.insertChild(root_child3, 3);
|
||||
@@ -619,19 +649,23 @@ test('column_gap_justify_flex_start', () => {
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
root.setGap(Gutter.Column, 10);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setWidth(20);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setWidth(20);
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setPositionType(PositionType.Relative);
|
||||
root_child2.setWidth(20);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
@@ -695,19 +729,23 @@ test('column_gap_justify_center', () => {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setJustifyContent(Justify.Center);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
root.setGap(Gutter.Column, 10);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setWidth(20);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setWidth(20);
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setPositionType(PositionType.Relative);
|
||||
root_child2.setWidth(20);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
@@ -771,19 +809,23 @@ test('column_gap_justify_flex_end', () => {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setJustifyContent(Justify.FlexEnd);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
root.setGap(Gutter.Column, 10);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setWidth(20);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setWidth(20);
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setPositionType(PositionType.Relative);
|
||||
root_child2.setWidth(20);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
@@ -847,19 +889,23 @@ test('column_gap_justify_space_between', () => {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setJustifyContent(Justify.SpaceBetween);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
root.setGap(Gutter.Column, 10);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setWidth(20);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setWidth(20);
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setPositionType(PositionType.Relative);
|
||||
root_child2.setWidth(20);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
@@ -923,19 +969,23 @@ test('column_gap_justify_space_around', () => {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setJustifyContent(Justify.SpaceAround);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
root.setGap(Gutter.Column, 10);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setWidth(20);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setWidth(20);
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setPositionType(PositionType.Relative);
|
||||
root_child2.setWidth(20);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
@@ -999,19 +1049,23 @@ test('column_gap_justify_space_evenly', () => {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setJustifyContent(Justify.SpaceEvenly);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
root.setGap(Gutter.Column, 10);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setWidth(20);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setWidth(20);
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setPositionType(PositionType.Relative);
|
||||
root_child2.setWidth(20);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
@@ -1074,6 +1128,7 @@ test('column_gap_wrap_align_flex_start', () => {
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setFlexWrap(Wrap.Wrap);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
@@ -1081,31 +1136,37 @@ test('column_gap_wrap_align_flex_start', () => {
|
||||
root.setGap(Gutter.Row, 20);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setWidth(20);
|
||||
root_child0.setHeight(20);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setWidth(20);
|
||||
root_child1.setHeight(20);
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setPositionType(PositionType.Relative);
|
||||
root_child2.setWidth(20);
|
||||
root_child2.setHeight(20);
|
||||
root.insertChild(root_child2, 2);
|
||||
|
||||
const root_child3 = Yoga.Node.create(config);
|
||||
root_child3.setPositionType(PositionType.Relative);
|
||||
root_child3.setWidth(20);
|
||||
root_child3.setHeight(20);
|
||||
root.insertChild(root_child3, 3);
|
||||
|
||||
const root_child4 = Yoga.Node.create(config);
|
||||
root_child4.setPositionType(PositionType.Relative);
|
||||
root_child4.setWidth(20);
|
||||
root_child4.setHeight(20);
|
||||
root.insertChild(root_child4, 4);
|
||||
|
||||
const root_child5 = Yoga.Node.create(config);
|
||||
root_child5.setPositionType(PositionType.Relative);
|
||||
root_child5.setWidth(20);
|
||||
root_child5.setHeight(20);
|
||||
root.insertChild(root_child5, 5);
|
||||
@@ -1200,6 +1261,7 @@ test('column_gap_wrap_align_center', () => {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setAlignContent(Align.Center);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setFlexWrap(Wrap.Wrap);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
@@ -1207,31 +1269,37 @@ test('column_gap_wrap_align_center', () => {
|
||||
root.setGap(Gutter.Row, 20);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setWidth(20);
|
||||
root_child0.setHeight(20);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setWidth(20);
|
||||
root_child1.setHeight(20);
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setPositionType(PositionType.Relative);
|
||||
root_child2.setWidth(20);
|
||||
root_child2.setHeight(20);
|
||||
root.insertChild(root_child2, 2);
|
||||
|
||||
const root_child3 = Yoga.Node.create(config);
|
||||
root_child3.setPositionType(PositionType.Relative);
|
||||
root_child3.setWidth(20);
|
||||
root_child3.setHeight(20);
|
||||
root.insertChild(root_child3, 3);
|
||||
|
||||
const root_child4 = Yoga.Node.create(config);
|
||||
root_child4.setPositionType(PositionType.Relative);
|
||||
root_child4.setWidth(20);
|
||||
root_child4.setHeight(20);
|
||||
root.insertChild(root_child4, 4);
|
||||
|
||||
const root_child5 = Yoga.Node.create(config);
|
||||
root_child5.setPositionType(PositionType.Relative);
|
||||
root_child5.setWidth(20);
|
||||
root_child5.setHeight(20);
|
||||
root.insertChild(root_child5, 5);
|
||||
@@ -1326,6 +1394,7 @@ test('column_gap_wrap_align_flex_end', () => {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setAlignContent(Align.FlexEnd);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setFlexWrap(Wrap.Wrap);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
@@ -1333,31 +1402,37 @@ test('column_gap_wrap_align_flex_end', () => {
|
||||
root.setGap(Gutter.Row, 20);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setWidth(20);
|
||||
root_child0.setHeight(20);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setWidth(20);
|
||||
root_child1.setHeight(20);
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setPositionType(PositionType.Relative);
|
||||
root_child2.setWidth(20);
|
||||
root_child2.setHeight(20);
|
||||
root.insertChild(root_child2, 2);
|
||||
|
||||
const root_child3 = Yoga.Node.create(config);
|
||||
root_child3.setPositionType(PositionType.Relative);
|
||||
root_child3.setWidth(20);
|
||||
root_child3.setHeight(20);
|
||||
root.insertChild(root_child3, 3);
|
||||
|
||||
const root_child4 = Yoga.Node.create(config);
|
||||
root_child4.setPositionType(PositionType.Relative);
|
||||
root_child4.setWidth(20);
|
||||
root_child4.setHeight(20);
|
||||
root.insertChild(root_child4, 4);
|
||||
|
||||
const root_child5 = Yoga.Node.create(config);
|
||||
root_child5.setPositionType(PositionType.Relative);
|
||||
root_child5.setWidth(20);
|
||||
root_child5.setHeight(20);
|
||||
root.insertChild(root_child5, 5);
|
||||
@@ -1452,6 +1527,7 @@ test('column_gap_wrap_align_space_between', () => {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setAlignContent(Align.SpaceBetween);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setFlexWrap(Wrap.Wrap);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
@@ -1459,31 +1535,37 @@ test('column_gap_wrap_align_space_between', () => {
|
||||
root.setGap(Gutter.Row, 20);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setWidth(20);
|
||||
root_child0.setHeight(20);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setWidth(20);
|
||||
root_child1.setHeight(20);
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setPositionType(PositionType.Relative);
|
||||
root_child2.setWidth(20);
|
||||
root_child2.setHeight(20);
|
||||
root.insertChild(root_child2, 2);
|
||||
|
||||
const root_child3 = Yoga.Node.create(config);
|
||||
root_child3.setPositionType(PositionType.Relative);
|
||||
root_child3.setWidth(20);
|
||||
root_child3.setHeight(20);
|
||||
root.insertChild(root_child3, 3);
|
||||
|
||||
const root_child4 = Yoga.Node.create(config);
|
||||
root_child4.setPositionType(PositionType.Relative);
|
||||
root_child4.setWidth(20);
|
||||
root_child4.setHeight(20);
|
||||
root.insertChild(root_child4, 4);
|
||||
|
||||
const root_child5 = Yoga.Node.create(config);
|
||||
root_child5.setPositionType(PositionType.Relative);
|
||||
root_child5.setWidth(20);
|
||||
root_child5.setHeight(20);
|
||||
root.insertChild(root_child5, 5);
|
||||
@@ -1578,6 +1660,7 @@ test('column_gap_wrap_align_space_around', () => {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setAlignContent(Align.SpaceAround);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setFlexWrap(Wrap.Wrap);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
@@ -1585,31 +1668,37 @@ test('column_gap_wrap_align_space_around', () => {
|
||||
root.setGap(Gutter.Row, 20);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setWidth(20);
|
||||
root_child0.setHeight(20);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setWidth(20);
|
||||
root_child1.setHeight(20);
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setPositionType(PositionType.Relative);
|
||||
root_child2.setWidth(20);
|
||||
root_child2.setHeight(20);
|
||||
root.insertChild(root_child2, 2);
|
||||
|
||||
const root_child3 = Yoga.Node.create(config);
|
||||
root_child3.setPositionType(PositionType.Relative);
|
||||
root_child3.setWidth(20);
|
||||
root_child3.setHeight(20);
|
||||
root.insertChild(root_child3, 3);
|
||||
|
||||
const root_child4 = Yoga.Node.create(config);
|
||||
root_child4.setPositionType(PositionType.Relative);
|
||||
root_child4.setWidth(20);
|
||||
root_child4.setHeight(20);
|
||||
root.insertChild(root_child4, 4);
|
||||
|
||||
const root_child5 = Yoga.Node.create(config);
|
||||
root_child5.setPositionType(PositionType.Relative);
|
||||
root_child5.setWidth(20);
|
||||
root_child5.setHeight(20);
|
||||
root.insertChild(root_child5, 5);
|
||||
@@ -1704,32 +1793,38 @@ test('column_gap_wrap_align_stretch', () => {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setAlignContent(Align.Stretch);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setFlexWrap(Wrap.Wrap);
|
||||
root.setWidth(300);
|
||||
root.setHeight(300);
|
||||
root.setGap(Gutter.Column, 5);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setFlexGrow(1);
|
||||
root_child0.setMinWidth(60);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setFlexGrow(1);
|
||||
root_child1.setMinWidth(60);
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setPositionType(PositionType.Relative);
|
||||
root_child2.setFlexGrow(1);
|
||||
root_child2.setMinWidth(60);
|
||||
root.insertChild(root_child2, 2);
|
||||
|
||||
const root_child3 = Yoga.Node.create(config);
|
||||
root_child3.setPositionType(PositionType.Relative);
|
||||
root_child3.setFlexGrow(1);
|
||||
root_child3.setMinWidth(60);
|
||||
root.insertChild(root_child3, 3);
|
||||
|
||||
const root_child4 = Yoga.Node.create(config);
|
||||
root_child4.setPositionType(PositionType.Relative);
|
||||
root_child4.setFlexGrow(1);
|
||||
root_child4.setMinWidth(60);
|
||||
root.insertChild(root_child4, 4);
|
||||
@@ -1813,18 +1908,22 @@ test('column_gap_determines_parent_width', () => {
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setHeight(100);
|
||||
root.setGap(Gutter.Column, 10);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setWidth(10);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setWidth(20);
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setPositionType(PositionType.Relative);
|
||||
root_child2.setWidth(30);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
@@ -1888,6 +1987,7 @@ test('row_gap_align_items_stretch', () => {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setAlignContent(Align.Stretch);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setFlexWrap(Wrap.Wrap);
|
||||
root.setWidth(100);
|
||||
root.setHeight(200);
|
||||
@@ -1895,26 +1995,32 @@ test('row_gap_align_items_stretch', () => {
|
||||
root.setGap(Gutter.Row, 20);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setWidth(20);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setWidth(20);
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setPositionType(PositionType.Relative);
|
||||
root_child2.setWidth(20);
|
||||
root.insertChild(root_child2, 2);
|
||||
|
||||
const root_child3 = Yoga.Node.create(config);
|
||||
root_child3.setPositionType(PositionType.Relative);
|
||||
root_child3.setWidth(20);
|
||||
root.insertChild(root_child3, 3);
|
||||
|
||||
const root_child4 = Yoga.Node.create(config);
|
||||
root_child4.setPositionType(PositionType.Relative);
|
||||
root_child4.setWidth(20);
|
||||
root.insertChild(root_child4, 4);
|
||||
|
||||
const root_child5 = Yoga.Node.create(config);
|
||||
root_child5.setPositionType(PositionType.Relative);
|
||||
root_child5.setWidth(20);
|
||||
root.insertChild(root_child5, 5);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
@@ -2008,6 +2114,7 @@ test('row_gap_align_items_end', () => {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setAlignItems(Align.FlexEnd);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setFlexWrap(Wrap.Wrap);
|
||||
root.setWidth(100);
|
||||
root.setHeight(200);
|
||||
@@ -2015,26 +2122,32 @@ test('row_gap_align_items_end', () => {
|
||||
root.setGap(Gutter.Row, 20);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setWidth(20);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setWidth(20);
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setPositionType(PositionType.Relative);
|
||||
root_child2.setWidth(20);
|
||||
root.insertChild(root_child2, 2);
|
||||
|
||||
const root_child3 = Yoga.Node.create(config);
|
||||
root_child3.setPositionType(PositionType.Relative);
|
||||
root_child3.setWidth(20);
|
||||
root.insertChild(root_child3, 3);
|
||||
|
||||
const root_child4 = Yoga.Node.create(config);
|
||||
root_child4.setPositionType(PositionType.Relative);
|
||||
root_child4.setWidth(20);
|
||||
root.insertChild(root_child4, 4);
|
||||
|
||||
const root_child5 = Yoga.Node.create(config);
|
||||
root_child5.setPositionType(PositionType.Relative);
|
||||
root_child5.setWidth(20);
|
||||
root.insertChild(root_child5, 5);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
@@ -2126,11 +2239,13 @@ test('row_gap_column_child_margins', () => {
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(100);
|
||||
root.setHeight(200);
|
||||
root.setGap(Gutter.Row, 10);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setFlexGrow(1);
|
||||
root_child0.setFlexShrink(1);
|
||||
root_child0.setFlexBasis("0%");
|
||||
@@ -2139,6 +2254,7 @@ test('row_gap_column_child_margins', () => {
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setFlexGrow(1);
|
||||
root_child1.setFlexShrink(1);
|
||||
root_child1.setFlexBasis("0%");
|
||||
@@ -2147,6 +2263,7 @@ test('row_gap_column_child_margins', () => {
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setPositionType(PositionType.Relative);
|
||||
root_child2.setFlexGrow(1);
|
||||
root_child2.setFlexShrink(1);
|
||||
root_child2.setFlexBasis("0%");
|
||||
@@ -2213,24 +2330,28 @@ test('row_gap_row_wrap_child_margins', () => {
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setFlexWrap(Wrap.Wrap);
|
||||
root.setWidth(100);
|
||||
root.setHeight(200);
|
||||
root.setGap(Gutter.Row, 10);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setMargin(Edge.Top, 2);
|
||||
root_child0.setMargin(Edge.Bottom, 2);
|
||||
root_child0.setWidth(60);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setMargin(Edge.Top, 10);
|
||||
root_child1.setMargin(Edge.Bottom, 10);
|
||||
root_child1.setWidth(60);
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setPositionType(PositionType.Relative);
|
||||
root_child2.setMargin(Edge.Top, 15);
|
||||
root_child2.setMargin(Edge.Bottom, 15);
|
||||
root_child2.setWidth(60);
|
||||
@@ -2294,18 +2415,22 @@ test('row_gap_determines_parent_height', () => {
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(100);
|
||||
root.setGap(Gutter.Row, 10);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setHeight(10);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setHeight(20);
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setPositionType(PositionType.Relative);
|
||||
root_child2.setHeight(30);
|
||||
root.insertChild(root_child2, 2);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
Reference in New Issue
Block a user