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,10 +34,12 @@ test('margin_start', () => {
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setMargin(Edge.Start, 10);
|
||||
root_child0.setWidth(10);
|
||||
root.insertChild(root_child0, 0);
|
||||
@@ -80,10 +82,12 @@ test('margin_top', () => {
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setMargin(Edge.Top, 10);
|
||||
root_child0.setHeight(10);
|
||||
root.insertChild(root_child0, 0);
|
||||
@@ -128,10 +132,12 @@ test('margin_end', () => {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setJustifyContent(Justify.FlexEnd);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setMargin(Edge.End, 10);
|
||||
root_child0.setWidth(10);
|
||||
root.insertChild(root_child0, 0);
|
||||
@@ -175,10 +181,12 @@ test('margin_bottom', () => {
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setJustifyContent(Justify.FlexEnd);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setMargin(Edge.Bottom, 10);
|
||||
root_child0.setHeight(10);
|
||||
root.insertChild(root_child0, 0);
|
||||
@@ -222,10 +230,12 @@ test('margin_and_flex_row', () => {
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setFlexGrow(1);
|
||||
root_child0.setMargin(Edge.Start, 10);
|
||||
root_child0.setMargin(Edge.End, 10);
|
||||
@@ -269,10 +279,12 @@ test('margin_and_flex_column', () => {
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setFlexGrow(1);
|
||||
root_child0.setMargin(Edge.Top, 10);
|
||||
root_child0.setMargin(Edge.Bottom, 10);
|
||||
@@ -317,10 +329,12 @@ test('margin_and_stretch_row', () => {
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setFlexGrow(1);
|
||||
root_child0.setMargin(Edge.Top, 10);
|
||||
root_child0.setMargin(Edge.Bottom, 10);
|
||||
@@ -364,10 +378,12 @@ test('margin_and_stretch_column', () => {
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setFlexGrow(1);
|
||||
root_child0.setMargin(Edge.Start, 10);
|
||||
root_child0.setMargin(Edge.End, 10);
|
||||
@@ -412,15 +428,18 @@ test('margin_with_sibling_row', () => {
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setFlexGrow(1);
|
||||
root_child0.setMargin(Edge.End, 10);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setFlexGrow(1);
|
||||
root.insertChild(root_child1, 1);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
@@ -472,15 +491,18 @@ test('margin_with_sibling_column', () => {
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setFlexGrow(1);
|
||||
root_child0.setMargin(Edge.Bottom, 10);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setFlexGrow(1);
|
||||
root.insertChild(root_child1, 1);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
@@ -533,16 +555,19 @@ test('margin_auto_bottom', () => {
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setAlignItems(Align.Center);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(200);
|
||||
root.setHeight(200);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setMargin(Edge.Bottom, 'auto');
|
||||
root_child0.setWidth(50);
|
||||
root_child0.setHeight(50);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setWidth(50);
|
||||
root_child1.setHeight(50);
|
||||
root.insertChild(root_child1, 1);
|
||||
@@ -596,16 +621,19 @@ test('margin_auto_top', () => {
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setAlignItems(Align.Center);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(200);
|
||||
root.setHeight(200);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setMargin(Edge.Top, 'auto');
|
||||
root_child0.setWidth(50);
|
||||
root_child0.setHeight(50);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setWidth(50);
|
||||
root_child1.setHeight(50);
|
||||
root.insertChild(root_child1, 1);
|
||||
@@ -659,10 +687,12 @@ test('margin_auto_bottom_and_top', () => {
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setAlignItems(Align.Center);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(200);
|
||||
root.setHeight(200);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setMargin(Edge.Top, 'auto');
|
||||
root_child0.setMargin(Edge.Bottom, 'auto');
|
||||
root_child0.setWidth(50);
|
||||
@@ -670,6 +700,7 @@ test('margin_auto_bottom_and_top', () => {
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setWidth(50);
|
||||
root_child1.setHeight(50);
|
||||
root.insertChild(root_child1, 1);
|
||||
@@ -723,10 +754,12 @@ test('margin_auto_bottom_and_top_justify_center', () => {
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setJustifyContent(Justify.Center);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(200);
|
||||
root.setHeight(200);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setMargin(Edge.Top, 'auto');
|
||||
root_child0.setMargin(Edge.Bottom, 'auto');
|
||||
root_child0.setWidth(50);
|
||||
@@ -734,6 +767,7 @@ test('margin_auto_bottom_and_top_justify_center', () => {
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setWidth(50);
|
||||
root_child1.setHeight(50);
|
||||
root.insertChild(root_child1, 1);
|
||||
@@ -787,22 +821,26 @@ test('margin_auto_mutiple_children_column', () => {
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setAlignItems(Align.Center);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(200);
|
||||
root.setHeight(200);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setMargin(Edge.Top, 'auto');
|
||||
root_child0.setWidth(50);
|
||||
root_child0.setHeight(50);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setMargin(Edge.Top, 'auto');
|
||||
root_child1.setWidth(50);
|
||||
root_child1.setHeight(50);
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setPositionType(PositionType.Relative);
|
||||
root_child2.setWidth(50);
|
||||
root_child2.setHeight(50);
|
||||
root.insertChild(root_child2, 2);
|
||||
@@ -867,22 +905,26 @@ test('margin_auto_mutiple_children_row', () => {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setAlignItems(Align.Center);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(200);
|
||||
root.setHeight(200);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setMargin(Edge.Right, 'auto');
|
||||
root_child0.setWidth(50);
|
||||
root_child0.setHeight(50);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setMargin(Edge.Right, 'auto');
|
||||
root_child1.setWidth(50);
|
||||
root_child1.setHeight(50);
|
||||
root.insertChild(root_child1, 1);
|
||||
|
||||
const root_child2 = Yoga.Node.create(config);
|
||||
root_child2.setPositionType(PositionType.Relative);
|
||||
root_child2.setWidth(50);
|
||||
root_child2.setHeight(50);
|
||||
root.insertChild(root_child2, 2);
|
||||
@@ -947,10 +989,12 @@ test('margin_auto_left_and_right_column', () => {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setAlignItems(Align.Center);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(200);
|
||||
root.setHeight(200);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setMargin(Edge.Left, 'auto');
|
||||
root_child0.setMargin(Edge.Right, 'auto');
|
||||
root_child0.setWidth(50);
|
||||
@@ -958,6 +1002,7 @@ test('margin_auto_left_and_right_column', () => {
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setWidth(50);
|
||||
root_child1.setHeight(50);
|
||||
root.insertChild(root_child1, 1);
|
||||
@@ -1010,10 +1055,12 @@ test('margin_auto_left_and_right', () => {
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(200);
|
||||
root.setHeight(200);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setMargin(Edge.Left, 'auto');
|
||||
root_child0.setMargin(Edge.Right, 'auto');
|
||||
root_child0.setWidth(50);
|
||||
@@ -1021,6 +1068,7 @@ test('margin_auto_left_and_right', () => {
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setWidth(50);
|
||||
root_child1.setHeight(50);
|
||||
root.insertChild(root_child1, 1);
|
||||
@@ -1075,10 +1123,12 @@ test('margin_auto_start_and_end_column', () => {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setAlignItems(Align.Center);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(200);
|
||||
root.setHeight(200);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setMargin(Edge.Start, 'auto');
|
||||
root_child0.setMargin(Edge.End, 'auto');
|
||||
root_child0.setWidth(50);
|
||||
@@ -1086,6 +1136,7 @@ test('margin_auto_start_and_end_column', () => {
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setWidth(50);
|
||||
root_child1.setHeight(50);
|
||||
root.insertChild(root_child1, 1);
|
||||
@@ -1138,10 +1189,12 @@ test('margin_auto_start_and_end', () => {
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(200);
|
||||
root.setHeight(200);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setMargin(Edge.Start, 'auto');
|
||||
root_child0.setMargin(Edge.End, 'auto');
|
||||
root_child0.setWidth(50);
|
||||
@@ -1149,6 +1202,7 @@ test('margin_auto_start_and_end', () => {
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setWidth(50);
|
||||
root_child1.setHeight(50);
|
||||
root.insertChild(root_child1, 1);
|
||||
@@ -1202,10 +1256,12 @@ test('margin_auto_left_and_right_column_and_center', () => {
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setAlignItems(Align.Center);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(200);
|
||||
root.setHeight(200);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setMargin(Edge.Left, 'auto');
|
||||
root_child0.setMargin(Edge.Right, 'auto');
|
||||
root_child0.setWidth(50);
|
||||
@@ -1213,6 +1269,7 @@ test('margin_auto_left_and_right_column_and_center', () => {
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setWidth(50);
|
||||
root_child1.setHeight(50);
|
||||
root.insertChild(root_child1, 1);
|
||||
@@ -1266,16 +1323,19 @@ test('margin_auto_left', () => {
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setAlignItems(Align.Center);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(200);
|
||||
root.setHeight(200);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setMargin(Edge.Left, 'auto');
|
||||
root_child0.setWidth(50);
|
||||
root_child0.setHeight(50);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setWidth(50);
|
||||
root_child1.setHeight(50);
|
||||
root.insertChild(root_child1, 1);
|
||||
@@ -1329,16 +1389,19 @@ test('margin_auto_right', () => {
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setAlignItems(Align.Center);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(200);
|
||||
root.setHeight(200);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setMargin(Edge.Right, 'auto');
|
||||
root_child0.setWidth(50);
|
||||
root_child0.setHeight(50);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setWidth(50);
|
||||
root_child1.setHeight(50);
|
||||
root.insertChild(root_child1, 1);
|
||||
@@ -1392,10 +1455,12 @@ test('margin_auto_left_and_right_stretch', () => {
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(FlexDirection.Row);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(200);
|
||||
root.setHeight(200);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setMargin(Edge.Left, 'auto');
|
||||
root_child0.setMargin(Edge.Right, 'auto');
|
||||
root_child0.setWidth(50);
|
||||
@@ -1403,6 +1468,7 @@ test('margin_auto_left_and_right_stretch', () => {
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setWidth(50);
|
||||
root_child1.setHeight(50);
|
||||
root.insertChild(root_child1, 1);
|
||||
@@ -1455,10 +1521,12 @@ test('margin_auto_top_and_bottom_stretch', () => {
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(200);
|
||||
root.setHeight(200);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setMargin(Edge.Top, 'auto');
|
||||
root_child0.setMargin(Edge.Bottom, 'auto');
|
||||
root_child0.setWidth(50);
|
||||
@@ -1466,6 +1534,7 @@ test('margin_auto_top_and_bottom_stretch', () => {
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setWidth(50);
|
||||
root_child1.setHeight(50);
|
||||
root.insertChild(root_child1, 1);
|
||||
@@ -1518,10 +1587,12 @@ test('margin_should_not_be_part_of_max_height', () => {
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(250);
|
||||
root.setHeight(250);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setMargin(Edge.Top, 20);
|
||||
root_child0.setWidth(100);
|
||||
root_child0.setHeight(100);
|
||||
@@ -1566,10 +1637,12 @@ test('margin_should_not_be_part_of_max_width', () => {
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(250);
|
||||
root.setHeight(250);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setMargin(Edge.Left, 20);
|
||||
root_child0.setWidth(100);
|
||||
root_child0.setMaxWidth(100);
|
||||
@@ -1615,10 +1688,12 @@ test('margin_auto_left_right_child_bigger_than_parent', () => {
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setJustifyContent(Justify.Center);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(52);
|
||||
root.setHeight(52);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setMargin(Edge.Left, 'auto');
|
||||
root_child0.setMargin(Edge.Right, 'auto');
|
||||
root_child0.setWidth(72);
|
||||
@@ -1664,10 +1739,12 @@ test('margin_auto_left_child_bigger_than_parent', () => {
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setJustifyContent(Justify.Center);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(52);
|
||||
root.setHeight(52);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setMargin(Edge.Left, 'auto');
|
||||
root_child0.setWidth(72);
|
||||
root_child0.setHeight(72);
|
||||
@@ -1712,10 +1789,12 @@ test('margin_fix_left_auto_right_child_bigger_than_parent', () => {
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setJustifyContent(Justify.Center);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(52);
|
||||
root.setHeight(52);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setMargin(Edge.Left, 10);
|
||||
root_child0.setMargin(Edge.Right, 'auto');
|
||||
root_child0.setWidth(72);
|
||||
@@ -1761,10 +1840,12 @@ test('margin_auto_left_fix_right_child_bigger_than_parent', () => {
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setJustifyContent(Justify.Center);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(52);
|
||||
root.setHeight(52);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setMargin(Edge.Left, 'auto');
|
||||
root_child0.setMargin(Edge.Right, 10);
|
||||
root_child0.setWidth(72);
|
||||
@@ -1810,10 +1891,12 @@ test('margin_auto_top_stretching_child', () => {
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setAlignItems(Align.Center);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(200);
|
||||
root.setHeight(200);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setFlexGrow(1);
|
||||
root_child0.setFlexShrink(1);
|
||||
root_child0.setFlexBasis("0%");
|
||||
@@ -1821,6 +1904,7 @@ test('margin_auto_top_stretching_child', () => {
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setWidth(50);
|
||||
root_child1.setHeight(50);
|
||||
root.insertChild(root_child1, 1);
|
||||
@@ -1874,10 +1958,12 @@ test('margin_auto_left_stretching_child', () => {
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setAlignItems(Align.Center);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(200);
|
||||
root.setHeight(200);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(PositionType.Relative);
|
||||
root_child0.setFlexGrow(1);
|
||||
root_child0.setFlexShrink(1);
|
||||
root_child0.setFlexBasis("0%");
|
||||
@@ -1885,6 +1971,7 @@ test('margin_auto_left_stretching_child', () => {
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(PositionType.Relative);
|
||||
root_child1.setWidth(50);
|
||||
root_child1.setHeight(50);
|
||||
root.insertChild(root_child1, 1);
|
||||
|
Reference in New Issue
Block a user