diff --git a/gentest/fixtures/YGIntrinsicSizeTest.html b/gentest/fixtures/YGIntrinsicSizeTest.html
index 962b24173f..587b1b8506 100644
--- a/gentest/fixtures/YGIntrinsicSizeTest.html
+++ b/gentest/fixtures/YGIntrinsicSizeTest.html
@@ -219,3 +219,251 @@
Sed at consectetur ipsum.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/gentest/gentest-cpp.js b/gentest/gentest-cpp.js
index b4d6f0872a..ac9c41f659 100644
--- a/gentest/gentest-cpp.js
+++ b/gentest/gentest-cpp.js
@@ -17,13 +17,25 @@ function toFunctionNameCpp(value) {
return 'Percent';
} else if (value.indexOf('Auto') >= 0) {
return 'Auto';
+ } else if (value.indexOf('MaxContent') >= 0) {
+ return 'MaxContent';
+ } else if (value.indexOf('FitContent') >= 0) {
+ return 'FitContent';
+ } else if (value.indexOf('Stretch') >= 0) {
+ return 'Stretch';
}
+
return '';
}
function keywordFunctionCpp(functionPrefix, nodeName, value) {
const functionSuffix = toFunctionNameCpp(value);
- if (functionSuffix == 'Auto') {
+ if (
+ functionSuffix == 'Auto' ||
+ functionSuffix == 'MaxContent' ||
+ functionSuffix == 'FitContent' ||
+ functionSuffix == 'Stretch'
+ ) {
return functionPrefix + functionSuffix + '(' + nodeName + ');';
} else {
return (
@@ -163,6 +175,10 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
YGDisplayContents: {value: 'YGDisplayContents'},
YGAuto: {value: 'YGAuto'},
+ YGMaxContent: {value: 'MaxContent'},
+ YGFitContent: {value: 'FitContent'},
+ YGStretch: {value: 'Stretch'},
+
YGNodeCalculateLayout: {
value: function (node, dir, _experiments) {
this.push(
@@ -382,57 +398,25 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
YGNodeStyleSetMaxHeight: {
value: function (nodeName, value) {
- this.push(
- 'YGNodeStyleSetMaxHeight' +
- toFunctionNameCpp(value) +
- '(' +
- nodeName +
- ', ' +
- toValueCpp(value) +
- ');',
- );
+ this.push(keywordFunctionCpp('YGNodeStyleSetMaxHeight', nodeName, value));
},
},
YGNodeStyleSetMaxWidth: {
value: function (nodeName, value) {
- this.push(
- 'YGNodeStyleSetMaxWidth' +
- toFunctionNameCpp(value) +
- '(' +
- nodeName +
- ', ' +
- toValueCpp(value) +
- ');',
- );
+ this.push(keywordFunctionCpp('YGNodeStyleSetMaxWidth', nodeName, value));
},
},
YGNodeStyleSetMinHeight: {
value: function (nodeName, value) {
- this.push(
- 'YGNodeStyleSetMinHeight' +
- toFunctionNameCpp(value) +
- '(' +
- nodeName +
- ', ' +
- toValueCpp(value) +
- ');',
- );
+ this.push(keywordFunctionCpp('YGNodeStyleSetMinHeight', nodeName, value));
},
},
YGNodeStyleSetMinWidth: {
value: function (nodeName, value) {
- this.push(
- 'YGNodeStyleSetMinWidth' +
- toFunctionNameCpp(value) +
- '(' +
- nodeName +
- ', ' +
- toValueCpp(value) +
- ');',
- );
+ this.push(keywordFunctionCpp('YGNodeStyleSetMinWidth', nodeName, value));
},
},
diff --git a/gentest/gentest-java.js b/gentest/gentest-java.js
index 12e86fcee5..bc2a587712 100644
--- a/gentest/gentest-java.js
+++ b/gentest/gentest-java.js
@@ -17,13 +17,24 @@ function toMethodName(value) {
return 'Percent';
} else if (value.indexOf('AUTO') >= 0) {
return 'Auto';
+ } else if (value.indexOf('MAX_CONTENT') >= 0) {
+ return 'MaxContent';
+ } else if (value.indexOf('FIT_CONTENT') >= 0) {
+ return 'FitContent';
+ } else if (value.indexOf('STRETCH') >= 0) {
+ return 'Stretch';
}
return '';
}
function keywordMethod(methodPrefix, nodeName, value) {
const methodSuffix = toMethodName(value);
- if (methodSuffix == 'Auto') {
+ if (
+ methodSuffix == 'Auto' ||
+ methodSuffix == 'MaxContent' ||
+ methodSuffix == 'FitContent' ||
+ methodSuffix == 'Stretch'
+ ) {
return nodeName + '.' + methodPrefix + methodSuffix + '();';
} else {
return (
@@ -205,6 +216,10 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
YGBoxSizingBorderBox: {value: 'YogaBoxSizing.BORDER_BOX'},
YGBoxSizingContentBox: {value: 'YogaBoxSizing.CONTENT_BOX'},
+ YGMaxContent: {value: 'MAX_CONTENT'},
+ YGFitContent: {value: 'FIT_CONTENT'},
+ YGStretch: {value: 'STRETCH'},
+
YGNodeCalculateLayout: {
value: function (node, dir, _experiments) {
this.push(node + '.setDirection(' + dir + ');');
@@ -360,53 +375,25 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
YGNodeStyleSetMaxHeight: {
value: function (nodeName, value) {
- this.push(
- nodeName +
- '.setMaxHeight' +
- toMethodName(value) +
- '(' +
- toValueJava(value) +
- 'f);',
- );
+ this.push(keywordMethod('setMaxHeight', nodeName, value));
},
},
YGNodeStyleSetMaxWidth: {
value: function (nodeName, value) {
- this.push(
- nodeName +
- '.setMaxWidth' +
- toMethodName(value) +
- '(' +
- toValueJava(value) +
- 'f);',
- );
+ this.push(keywordMethod('setMaxWidth', nodeName, value));
},
},
YGNodeStyleSetMinHeight: {
value: function (nodeName, value) {
- this.push(
- nodeName +
- '.setMinHeight' +
- toMethodName(value) +
- '(' +
- toValueJava(value) +
- 'f);',
- );
+ this.push(keywordMethod('setMinHeight', nodeName, value));
},
},
YGNodeStyleSetMinWidth: {
value: function (nodeName, value) {
- this.push(
- nodeName +
- '.setMinWidth' +
- toMethodName(value) +
- '(' +
- toValueJava(value) +
- 'f);',
- );
+ this.push(keywordMethod('setMinWidth', nodeName, value));
},
},
diff --git a/gentest/gentest-javascript.js b/gentest/gentest-javascript.js
index 4af0bc2537..1eac141008 100644
--- a/gentest/gentest-javascript.js
+++ b/gentest/gentest-javascript.js
@@ -15,6 +15,9 @@ function toValueJavascript(value) {
if (value.match(/^[0-9.e+-]+px$/i)) return parseFloat(value);
if (value.match(/^[0-9.e+-]+%/i)) return JSON.stringify(value);
if (value == 'Yoga.AUTO') return '"auto"';
+ if (value == 'max-content') return '"max-content"';
+ if (value == 'fit-content') return '"fit-content"';
+ if (value == 'stretch') return '"stretch"';
return value;
}
@@ -176,6 +179,10 @@ JavascriptEmitter.prototype = Object.create(Emitter.prototype, {
YGBoxSizingBorderBox: {value: 'BoxSizing.BorderBox'},
YGBoxSizingContentBox: {value: 'BoxSizing.ContentBox'},
+ YGMaxContent: {value: 'max-content'},
+ YGFitContent: {value: 'fit-content'},
+ YGStretch: {value: 'stretch'},
+
YGNodeCalculateLayout: {
value: function (node, dir, _experiments) {
this.push(node + '.calculateLayout(undefined, undefined, ' + dir + ');');
diff --git a/gentest/gentest.js b/gentest/gentest.js
index 7e56644e4e..d04e3d0ded 100755
--- a/gentest/gentest.js
+++ b/gentest/gentest.js
@@ -654,6 +654,13 @@ function pointValue(e, value) {
return e.YGAuto;
case 'undefined':
return e.YGUndefined;
+ case 'max-content':
+ return e.YGMaxContent;
+ case 'fit-content':
+ return e.YGFitContent;
+ case 'stretch':
+ case '-webkit-fill-available':
+ return e.YGStretch;
default:
return value;
}
diff --git a/java/tests/generated/com/facebook/yoga/YGIntrinsicSizeTest.java b/java/tests/generated/com/facebook/yoga/YGIntrinsicSizeTest.java
index 26b511329a..7ff0d0f096 100644
--- a/java/tests/generated/com/facebook/yoga/YGIntrinsicSizeTest.java
+++ b/java/tests/generated/com/facebook/yoga/YGIntrinsicSizeTest.java
@@ -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<>
+ * @generated SignedSource<<1610045e3d68262896d841906a8fe1a7>>
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGIntrinsicSizeTest.html
*/
@@ -499,6 +499,1936 @@ public void test_contains_inner_text_max_height() {
assertEquals(20f, root_child0.getLayoutHeight(), 0.0f);
}
+ @Test
+ public void test_max_content_width() {
+ YogaConfig config = YogaConfigFactory.create();
+
+ final YogaNode root = createNode(config);
+ root.setFlexDirection(YogaFlexDirection.ROW);
+ root.setPositionType(YogaPositionType.ABSOLUTE);
+ root.setWrap(YogaWrap.WRAP);
+ root.setWidthMaxContent();
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWidth(50f);
+ root_child0.setHeight(50f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child1 = createNode(config);
+ root_child1.setWidth(100f);
+ root_child1.setHeight(50f);
+ root.addChildAt(root_child1, 1);
+
+ final YogaNode root_child2 = createNode(config);
+ root_child2.setWidth(25f);
+ root_child2.setHeight(50f);
+ root.addChildAt(root_child2, 2);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(175f, root.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(50f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(150f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(25f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(175f, root.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(125f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(25f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(25f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_fit_content_width() {
+ YogaConfig config = YogaConfigFactory.create();
+
+ final YogaNode root = createNode(config);
+ root.setWidth(90f);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setFlexDirection(YogaFlexDirection.ROW);
+ root_child0.setWrap(YogaWrap.WRAP);
+ root_child0.setWidthFitContent();
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setWidth(50f);
+ root_child0_child0.setHeight(50f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child1 = createNode(config);
+ root_child0_child1.setWidth(100f);
+ root_child0_child1.setHeight(50f);
+ root_child0.addChildAt(root_child0_child1, 1);
+
+ final YogaNode root_child0_child2 = createNode(config);
+ root_child0_child2.setWidth(25f);
+ root_child0_child2.setHeight(50f);
+ root_child0.addChildAt(root_child0_child2, 2);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(90f, root.getLayoutWidth(), 0.0f);
+ assertEquals(150f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(150f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f);
+ assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f);
+ assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child2.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(90f, root.getLayoutWidth(), 0.0f);
+ assertEquals(150f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(-10f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(150f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(50f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(75f, root_child0_child2.getLayoutX(), 0.0f);
+ assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f);
+ assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child2.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_stretch_width() {
+ YogaConfig config = YogaConfigFactory.create();
+
+ final YogaNode root = createNode(config);
+ root.setWidth(500f);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setFlexDirection(YogaFlexDirection.ROW);
+ root_child0.setWrap(YogaWrap.WRAP);
+ root_child0.setWidthStretch();
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setWidth(50f);
+ root_child0_child0.setHeight(50f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child1 = createNode(config);
+ root_child0_child1.setWidth(100f);
+ root_child0_child1.setHeight(50f);
+ root_child0.addChildAt(root_child0_child1, 1);
+
+ final YogaNode root_child0_child2 = createNode(config);
+ root_child0_child2.setWidth(25f);
+ root_child0_child2.setHeight(50f);
+ root_child0.addChildAt(root_child0_child2, 2);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(150f, root.getLayoutY(), 0.0f);
+ assertEquals(500f, root.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(500f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(50f, root_child0_child1.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(150f, root_child0_child2.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
+ assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child2.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(150f, root.getLayoutY(), 0.0f);
+ assertEquals(500f, root.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(500f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(450f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(350f, root_child0_child1.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(325f, root_child0_child2.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
+ assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child2.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ public void test_max_content_height() {
+ YogaConfig config = YogaConfigFactory.create();
+
+ final YogaNode root = createNode(config);
+ root.setPositionType(YogaPositionType.ABSOLUTE);
+ root.setWrap(YogaWrap.WRAP);
+ root.setHeightMaxContent();
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWidth(50f);
+ root_child0.setHeight(50f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child1 = createNode(config);
+ root_child1.setWidth(50f);
+ root_child1.setHeight(100f);
+ root.addChildAt(root_child1, 1);
+
+ final YogaNode root_child2 = createNode(config);
+ root_child2.setWidth(50f);
+ root_child2.setHeight(25f);
+ root.addChildAt(root_child2, 2);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(50f, root.getLayoutWidth(), 0.0f);
+ assertEquals(175f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(150f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(25f, root_child2.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(50f, root.getLayoutWidth(), 0.0f);
+ assertEquals(175f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(150f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(25f, root_child2.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_fit_content_height() {
+ YogaConfig config = YogaConfigFactory.create();
+
+ final YogaNode root = createNode(config);
+ root.setHeight(90f);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWrap(YogaWrap.WRAP);
+ root_child0.setHeightFitContent();
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setWidth(50f);
+ root_child0_child0.setHeight(50f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child1 = createNode(config);
+ root_child0_child1.setWidth(50f);
+ root_child0_child1.setHeight(100f);
+ root_child0.addChildAt(root_child0_child1, 1);
+
+ final YogaNode root_child0_child2 = createNode(config);
+ root_child0_child2.setWidth(50f);
+ root_child0_child2.setHeight(25f);
+ root_child0.addChildAt(root_child0_child2, 2);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(200f, root.getLayoutY(), 0.0f);
+ assertEquals(500f, root.getLayoutWidth(), 0.0f);
+ assertEquals(90f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(500f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(175f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f);
+ assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f);
+ assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(200f, root.getLayoutY(), 0.0f);
+ assertEquals(500f, root.getLayoutWidth(), 0.0f);
+ assertEquals(90f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(500f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(175f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(450f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(450f, root_child0_child1.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(450f, root_child0_child2.getLayoutX(), 0.0f);
+ assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f);
+ assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_stretch_height() {
+ YogaConfig config = YogaConfigFactory.create();
+
+ final YogaNode root = createNode(config);
+ root.setHeight(500f);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWrap(YogaWrap.WRAP);
+ root_child0.setHeightStretch();
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setWidth(50f);
+ root_child0_child0.setHeight(50f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child1 = createNode(config);
+ root_child0_child1.setWidth(50f);
+ root_child0_child1.setHeight(100f);
+ root_child0.addChildAt(root_child0_child1, 1);
+
+ final YogaNode root_child0_child2 = createNode(config);
+ root_child0_child2.setWidth(50f);
+ root_child0_child2.setHeight(25f);
+ root_child0.addChildAt(root_child0_child2, 2);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(290f, root.getLayoutY(), 0.0f);
+ assertEquals(500f, root.getLayoutWidth(), 0.0f);
+ assertEquals(500f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(500f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(175f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f);
+ assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f);
+ assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(290f, root.getLayoutY(), 0.0f);
+ assertEquals(500f, root.getLayoutWidth(), 0.0f);
+ assertEquals(500f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(500f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(175f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(450f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(450f, root_child0_child1.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(450f, root_child0_child2.getLayoutX(), 0.0f);
+ assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f);
+ assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ public void test_max_content_flex_basis_column() {
+ YogaConfig config = YogaConfigFactory.create();
+
+ final YogaNode root = createNode(config);
+ root.setPositionType(YogaPositionType.ABSOLUTE);
+ root.setWrap(YogaWrap.WRAP);
+ root.setFlexBasisMaxContent();
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWidth(50f);
+ root_child0.setHeight(50f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child1 = createNode(config);
+ root_child1.setWidth(50f);
+ root_child1.setHeight(100f);
+ root.addChildAt(root_child1, 1);
+
+ final YogaNode root_child2 = createNode(config);
+ root_child2.setWidth(50f);
+ root_child2.setHeight(25f);
+ root.addChildAt(root_child2, 2);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(50f, root.getLayoutWidth(), 0.0f);
+ assertEquals(175f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(150f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(25f, root_child2.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(50f, root.getLayoutWidth(), 0.0f);
+ assertEquals(175f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(150f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(25f, root_child2.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_fit_content_flex_basis_column() {
+ YogaConfig config = YogaConfigFactory.create();
+
+ final YogaNode root = createNode(config);
+ root.setHeight(90f);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWrap(YogaWrap.WRAP);
+ root_child0.setFlexBasisFitContent();
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setWidth(50f);
+ root_child0_child0.setHeight(50f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child1 = createNode(config);
+ root_child0_child1.setWidth(50f);
+ root_child0_child1.setHeight(100f);
+ root_child0.addChildAt(root_child0_child1, 1);
+
+ final YogaNode root_child0_child2 = createNode(config);
+ root_child0_child2.setWidth(50f);
+ root_child0_child2.setHeight(25f);
+ root_child0.addChildAt(root_child0_child2, 2);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(790f, root.getLayoutY(), 0.0f);
+ assertEquals(500f, root.getLayoutWidth(), 0.0f);
+ assertEquals(90f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(500f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(175f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f);
+ assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f);
+ assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(790f, root.getLayoutY(), 0.0f);
+ assertEquals(500f, root.getLayoutWidth(), 0.0f);
+ assertEquals(90f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(500f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(175f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(450f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(450f, root_child0_child1.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(450f, root_child0_child2.getLayoutX(), 0.0f);
+ assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f);
+ assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_stretch_flex_basis_column() {
+ YogaConfig config = YogaConfigFactory.create();
+
+ final YogaNode root = createNode(config);
+ root.setHeight(500f);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWrap(YogaWrap.WRAP);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setWidth(50f);
+ root_child0_child0.setHeight(50f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child1 = createNode(config);
+ root_child0_child1.setWidth(50f);
+ root_child0_child1.setHeight(100f);
+ root_child0.addChildAt(root_child0_child1, 1);
+
+ final YogaNode root_child0_child2 = createNode(config);
+ root_child0_child2.setWidth(50f);
+ root_child0_child2.setHeight(25f);
+ root_child0.addChildAt(root_child0_child2, 2);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(880f, root.getLayoutY(), 0.0f);
+ assertEquals(500f, root.getLayoutWidth(), 0.0f);
+ assertEquals(500f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(500f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(175f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f);
+ assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f);
+ assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(880f, root.getLayoutY(), 0.0f);
+ assertEquals(500f, root.getLayoutWidth(), 0.0f);
+ assertEquals(500f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(500f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(175f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(450f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(450f, root_child0_child1.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(450f, root_child0_child2.getLayoutX(), 0.0f);
+ assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f);
+ assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ public void test_max_content_flex_basis_row() {
+ YogaConfig config = YogaConfigFactory.create();
+
+ final YogaNode root = createNode(config);
+ root.setFlexDirection(YogaFlexDirection.ROW);
+ root.setPositionType(YogaPositionType.ABSOLUTE);
+ root.setWrap(YogaWrap.WRAP);
+ root.setFlexBasisMaxContent();
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWidth(50f);
+ root_child0.setHeight(50f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child1 = createNode(config);
+ root_child1.setWidth(100f);
+ root_child1.setHeight(500f);
+ root.addChildAt(root_child1, 1);
+
+ final YogaNode root_child2 = createNode(config);
+ root_child2.setWidth(25f);
+ root_child2.setHeight(50f);
+ root.addChildAt(root_child2, 2);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(175f, root.getLayoutWidth(), 0.0f);
+ assertEquals(500f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(50f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(500f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(150f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(25f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(175f, root.getLayoutWidth(), 0.0f);
+ assertEquals(500f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(125f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(25f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(500f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(25f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_fit_content_flex_basis_row() {
+ YogaConfig config = YogaConfigFactory.create();
+
+ final YogaNode root = createNode(config);
+ root.setWidth(90f);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setFlexDirection(YogaFlexDirection.ROW);
+ root_child0.setWrap(YogaWrap.WRAP);
+ root_child0.setFlexBasisFitContent();
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setWidth(50f);
+ root_child0_child0.setHeight(50f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child1 = createNode(config);
+ root_child0_child1.setWidth(100f);
+ root_child0_child1.setHeight(50f);
+ root_child0.addChildAt(root_child0_child1, 1);
+
+ final YogaNode root_child0_child2 = createNode(config);
+ root_child0_child2.setWidth(25f);
+ root_child0_child2.setHeight(50f);
+ root_child0.addChildAt(root_child0_child2, 2);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(1380f, root.getLayoutY(), 0.0f);
+ assertEquals(90f, root.getLayoutWidth(), 0.0f);
+ assertEquals(150f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(90f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(150f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f);
+ assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f);
+ assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child2.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(1380f, root.getLayoutY(), 0.0f);
+ assertEquals(90f, root.getLayoutWidth(), 0.0f);
+ assertEquals(150f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(90f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(150f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(40f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(-10f, root_child0_child1.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(65f, root_child0_child2.getLayoutX(), 0.0f);
+ assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f);
+ assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child2.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_stretch_flex_basis_row() {
+ YogaConfig config = YogaConfigFactory.create();
+
+ final YogaNode root = createNode(config);
+ root.setWidth(500f);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setFlexDirection(YogaFlexDirection.ROW);
+ root_child0.setWrap(YogaWrap.WRAP);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setWidth(50f);
+ root_child0_child0.setHeight(50f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child1 = createNode(config);
+ root_child0_child1.setWidth(100f);
+ root_child0_child1.setHeight(50f);
+ root_child0.addChildAt(root_child0_child1, 1);
+
+ final YogaNode root_child0_child2 = createNode(config);
+ root_child0_child2.setWidth(25f);
+ root_child0_child2.setHeight(50f);
+ root_child0.addChildAt(root_child0_child2, 2);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(1530f, root.getLayoutY(), 0.0f);
+ assertEquals(500f, root.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(500f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(50f, root_child0_child1.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(150f, root_child0_child2.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
+ assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child2.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(1530f, root.getLayoutY(), 0.0f);
+ assertEquals(500f, root.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(500f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(450f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(350f, root_child0_child1.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(325f, root_child0_child2.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
+ assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child2.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_max_content_max_width() {
+ YogaConfig config = YogaConfigFactory.create();
+
+ final YogaNode root = createNode(config);
+ root.setFlexDirection(YogaFlexDirection.ROW);
+ root.setPositionType(YogaPositionType.ABSOLUTE);
+ root.setWrap(YogaWrap.WRAP);
+ root.setWidth(200f);
+ root.setMaxWidthMaxContent();
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWidth(50f);
+ root_child0.setHeight(50f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child1 = createNode(config);
+ root_child1.setWidth(100f);
+ root_child1.setHeight(50f);
+ root.addChildAt(root_child1, 1);
+
+ final YogaNode root_child2 = createNode(config);
+ root_child2.setWidth(25f);
+ root_child2.setHeight(50f);
+ root.addChildAt(root_child2, 2);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(175f, root.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(50f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(150f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(25f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(175f, root.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(125f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(25f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(25f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_fit_content_max_width() {
+ YogaConfig config = YogaConfigFactory.create();
+
+ final YogaNode root = createNode(config);
+ root.setWidth(90f);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setFlexDirection(YogaFlexDirection.ROW);
+ root_child0.setWrap(YogaWrap.WRAP);
+ root_child0.setWidth(110f);
+ root_child0.setMaxWidthFitContent();
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setWidth(50f);
+ root_child0_child0.setHeight(50f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child1 = createNode(config);
+ root_child0_child1.setWidth(100f);
+ root_child0_child1.setHeight(50f);
+ root_child0.addChildAt(root_child0_child1, 1);
+
+ final YogaNode root_child0_child2 = createNode(config);
+ root_child0_child2.setWidth(25f);
+ root_child0_child2.setHeight(50f);
+ root_child0.addChildAt(root_child0_child2, 2);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(1580f, root.getLayoutY(), 0.0f);
+ assertEquals(90f, root.getLayoutWidth(), 0.0f);
+ assertEquals(150f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(150f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f);
+ assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f);
+ assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child2.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(1580f, root.getLayoutY(), 0.0f);
+ assertEquals(90f, root.getLayoutWidth(), 0.0f);
+ assertEquals(150f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(-10f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(150f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(50f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(75f, root_child0_child2.getLayoutX(), 0.0f);
+ assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f);
+ assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child2.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_stretch_max_width() {
+ YogaConfig config = YogaConfigFactory.create();
+
+ final YogaNode root = createNode(config);
+ root.setWidth(500f);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setFlexDirection(YogaFlexDirection.ROW);
+ root_child0.setWrap(YogaWrap.WRAP);
+ root_child0.setWidth(600f);
+ root_child0.setMaxWidthStretch();
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setWidth(50f);
+ root_child0_child0.setHeight(50f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child1 = createNode(config);
+ root_child0_child1.setWidth(100f);
+ root_child0_child1.setHeight(50f);
+ root_child0.addChildAt(root_child0_child1, 1);
+
+ final YogaNode root_child0_child2 = createNode(config);
+ root_child0_child2.setWidth(25f);
+ root_child0_child2.setHeight(50f);
+ root_child0.addChildAt(root_child0_child2, 2);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(1730f, root.getLayoutY(), 0.0f);
+ assertEquals(500f, root.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(500f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(50f, root_child0_child1.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(150f, root_child0_child2.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
+ assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child2.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(1730f, root.getLayoutY(), 0.0f);
+ assertEquals(500f, root.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(500f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(450f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(350f, root_child0_child1.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(325f, root_child0_child2.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
+ assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child2.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_max_content_min_width() {
+ YogaConfig config = YogaConfigFactory.create();
+
+ final YogaNode root = createNode(config);
+ root.setFlexDirection(YogaFlexDirection.ROW);
+ root.setPositionType(YogaPositionType.ABSOLUTE);
+ root.setWrap(YogaWrap.WRAP);
+ root.setWidth(100f);
+ root.setMinWidthMaxContent();
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWidth(50f);
+ root_child0.setHeight(50f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child1 = createNode(config);
+ root_child1.setWidth(100f);
+ root_child1.setHeight(50f);
+ root.addChildAt(root_child1, 1);
+
+ final YogaNode root_child2 = createNode(config);
+ root_child2.setWidth(25f);
+ root_child2.setHeight(50f);
+ root.addChildAt(root_child2, 2);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(175f, root.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(50f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(150f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(25f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(175f, root.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(125f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(25f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(25f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_fit_content_min_width() {
+ YogaConfig config = YogaConfigFactory.create();
+
+ final YogaNode root = createNode(config);
+ root.setWidth(90f);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setFlexDirection(YogaFlexDirection.ROW);
+ root_child0.setWrap(YogaWrap.WRAP);
+ root_child0.setWidth(90f);
+ root_child0.setMinWidthFitContent();
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setWidth(50f);
+ root_child0_child0.setHeight(50f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child1 = createNode(config);
+ root_child0_child1.setWidth(100f);
+ root_child0_child1.setHeight(50f);
+ root_child0.addChildAt(root_child0_child1, 1);
+
+ final YogaNode root_child0_child2 = createNode(config);
+ root_child0_child2.setWidth(25f);
+ root_child0_child2.setHeight(50f);
+ root_child0.addChildAt(root_child0_child2, 2);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(1780f, root.getLayoutY(), 0.0f);
+ assertEquals(90f, root.getLayoutWidth(), 0.0f);
+ assertEquals(150f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(150f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f);
+ assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f);
+ assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child2.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(1780f, root.getLayoutY(), 0.0f);
+ assertEquals(90f, root.getLayoutWidth(), 0.0f);
+ assertEquals(150f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(-10f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(150f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(50f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(75f, root_child0_child2.getLayoutX(), 0.0f);
+ assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f);
+ assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child2.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_stretch_min_width() {
+ YogaConfig config = YogaConfigFactory.create();
+
+ final YogaNode root = createNode(config);
+ root.setWidth(500f);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setFlexDirection(YogaFlexDirection.ROW);
+ root_child0.setWrap(YogaWrap.WRAP);
+ root_child0.setWidth(400f);
+ root_child0.setMinWidthStretch();
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setWidth(50f);
+ root_child0_child0.setHeight(50f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child1 = createNode(config);
+ root_child0_child1.setWidth(100f);
+ root_child0_child1.setHeight(50f);
+ root_child0.addChildAt(root_child0_child1, 1);
+
+ final YogaNode root_child0_child2 = createNode(config);
+ root_child0_child2.setWidth(25f);
+ root_child0_child2.setHeight(50f);
+ root_child0.addChildAt(root_child0_child2, 2);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(1930f, root.getLayoutY(), 0.0f);
+ assertEquals(500f, root.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(500f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(50f, root_child0_child1.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(150f, root_child0_child2.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
+ assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child2.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(1930f, root.getLayoutY(), 0.0f);
+ assertEquals(500f, root.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(500f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(450f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(350f, root_child0_child1.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
+ assertEquals(100f, root_child0_child1.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(325f, root_child0_child2.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
+ assertEquals(25f, root_child0_child2.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child2.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_max_content_max_height() {
+ YogaConfig config = YogaConfigFactory.create();
+
+ final YogaNode root = createNode(config);
+ root.setPositionType(YogaPositionType.ABSOLUTE);
+ root.setWrap(YogaWrap.WRAP);
+ root.setHeight(200f);
+ root.setMaxHeightMaxContent();
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWidth(50f);
+ root_child0.setHeight(50f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child1 = createNode(config);
+ root_child1.setWidth(50f);
+ root_child1.setHeight(100f);
+ root.addChildAt(root_child1, 1);
+
+ final YogaNode root_child2 = createNode(config);
+ root_child2.setWidth(50f);
+ root_child2.setHeight(25f);
+ root.addChildAt(root_child2, 2);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(50f, root.getLayoutWidth(), 0.0f);
+ assertEquals(175f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(150f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(25f, root_child2.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(50f, root.getLayoutWidth(), 0.0f);
+ assertEquals(175f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(150f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(25f, root_child2.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_fit_content_max_height() {
+ YogaConfig config = YogaConfigFactory.create();
+
+ final YogaNode root = createNode(config);
+ root.setHeight(90f);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWrap(YogaWrap.WRAP);
+ root_child0.setHeight(110f);
+ root_child0.setMaxHeightFitContent();
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setWidth(50f);
+ root_child0_child0.setHeight(50f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child1 = createNode(config);
+ root_child0_child1.setWidth(50f);
+ root_child0_child1.setHeight(100f);
+ root_child0.addChildAt(root_child0_child1, 1);
+
+ final YogaNode root_child0_child2 = createNode(config);
+ root_child0_child2.setWidth(50f);
+ root_child0_child2.setHeight(25f);
+ root_child0.addChildAt(root_child0_child2, 2);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(1980f, root.getLayoutY(), 0.0f);
+ assertEquals(500f, root.getLayoutWidth(), 0.0f);
+ assertEquals(90f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(500f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(50f, root_child0_child1.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child2.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f);
+ assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(1980f, root.getLayoutY(), 0.0f);
+ assertEquals(500f, root.getLayoutWidth(), 0.0f);
+ assertEquals(90f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(500f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(450f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(400f, root_child0_child1.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(350f, root_child0_child2.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f);
+ assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_stretch_max_height() {
+ YogaConfig config = YogaConfigFactory.create();
+
+ final YogaNode root = createNode(config);
+ root.setHeight(500f);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWrap(YogaWrap.WRAP);
+ root_child0.setHeight(600f);
+ root_child0.setMaxHeightStretch();
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setWidth(50f);
+ root_child0_child0.setHeight(50f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child1 = createNode(config);
+ root_child0_child1.setWidth(50f);
+ root_child0_child1.setHeight(100f);
+ root_child0.addChildAt(root_child0_child1, 1);
+
+ final YogaNode root_child0_child2 = createNode(config);
+ root_child0_child2.setWidth(50f);
+ root_child0_child2.setHeight(25f);
+ root_child0.addChildAt(root_child0_child2, 2);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(2070f, root.getLayoutY(), 0.0f);
+ assertEquals(500f, root.getLayoutWidth(), 0.0f);
+ assertEquals(500f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(500f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(600f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f);
+ assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f);
+ assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(2070f, root.getLayoutY(), 0.0f);
+ assertEquals(500f, root.getLayoutWidth(), 0.0f);
+ assertEquals(500f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(500f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(600f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(450f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(450f, root_child0_child1.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(450f, root_child0_child2.getLayoutX(), 0.0f);
+ assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f);
+ assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_max_content_min_height() {
+ YogaConfig config = YogaConfigFactory.create();
+
+ final YogaNode root = createNode(config);
+ root.setPositionType(YogaPositionType.ABSOLUTE);
+ root.setWrap(YogaWrap.WRAP);
+ root.setHeight(100f);
+ root.setMinHeightMaxContent();
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWidth(50f);
+ root_child0.setHeight(50f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child1 = createNode(config);
+ root_child1.setWidth(50f);
+ root_child1.setHeight(100f);
+ root.addChildAt(root_child1, 1);
+
+ final YogaNode root_child2 = createNode(config);
+ root_child2.setWidth(50f);
+ root_child2.setHeight(25f);
+ root.addChildAt(root_child2, 2);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(50f, root.getLayoutWidth(), 0.0f);
+ assertEquals(175f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(150f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(25f, root_child2.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(0f, root.getLayoutY(), 0.0f);
+ assertEquals(50f, root.getLayoutWidth(), 0.0f);
+ assertEquals(175f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child1.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child2.getLayoutX(), 0.0f);
+ assertEquals(150f, root_child2.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
+ assertEquals(25f, root_child2.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_fit_content_min_height() {
+ YogaConfig config = YogaConfigFactory.create();
+
+ final YogaNode root = createNode(config);
+ root.setHeight(90f);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWrap(YogaWrap.WRAP);
+ root_child0.setHeight(90f);
+ root_child0.setMinHeightFitContent();
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setWidth(50f);
+ root_child0_child0.setHeight(50f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child1 = createNode(config);
+ root_child0_child1.setWidth(50f);
+ root_child0_child1.setHeight(100f);
+ root_child0.addChildAt(root_child0_child1, 1);
+
+ final YogaNode root_child0_child2 = createNode(config);
+ root_child0_child2.setWidth(50f);
+ root_child0_child2.setHeight(25f);
+ root_child0.addChildAt(root_child0_child2, 2);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(2570f, root.getLayoutY(), 0.0f);
+ assertEquals(500f, root.getLayoutWidth(), 0.0f);
+ assertEquals(90f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(500f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(175f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f);
+ assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f);
+ assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(2570f, root.getLayoutY(), 0.0f);
+ assertEquals(500f, root.getLayoutWidth(), 0.0f);
+ assertEquals(90f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(500f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(175f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(450f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(450f, root_child0_child1.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(450f, root_child0_child2.getLayoutX(), 0.0f);
+ assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f);
+ assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ @Ignore
+ public void test_stretch_min_height() {
+ YogaConfig config = YogaConfigFactory.create();
+
+ final YogaNode root = createNode(config);
+ root.setHeight(500f);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setWrap(YogaWrap.WRAP);
+ root_child0.setHeight(400f);
+ root_child0.setMinHeightStretch();
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setWidth(50f);
+ root_child0_child0.setHeight(50f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child1 = createNode(config);
+ root_child0_child1.setWidth(50f);
+ root_child0_child1.setHeight(100f);
+ root_child0.addChildAt(root_child0_child1, 1);
+
+ final YogaNode root_child0_child2 = createNode(config);
+ root_child0_child2.setWidth(50f);
+ root_child0_child2.setHeight(25f);
+ root_child0.addChildAt(root_child0_child2, 2);
+ root.setDirection(YogaDirection.LTR);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(2660f, root.getLayoutY(), 0.0f);
+ assertEquals(500f, root.getLayoutWidth(), 0.0f);
+ assertEquals(500f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(500f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(400f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f);
+ assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f);
+ assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f);
+
+ root.setDirection(YogaDirection.RTL);
+ root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
+
+ assertEquals(0f, root.getLayoutX(), 0.0f);
+ assertEquals(2660f, root.getLayoutY(), 0.0f);
+ assertEquals(500f, root.getLayoutWidth(), 0.0f);
+ assertEquals(500f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(500f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(400f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(450f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(450f, root_child0_child1.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child1.getLayoutWidth(), 0.0f);
+ assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
+
+ assertEquals(450f, root_child0_child2.getLayoutX(), 0.0f);
+ assertEquals(150f, root_child0_child2.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child2.getLayoutWidth(), 0.0f);
+ assertEquals(25f, root_child0_child2.getLayoutHeight(), 0.0f);
+ }
+
private YogaNode createNode(YogaConfig config) {
return mNodeFactory.create(config);
}
diff --git a/javascript/tests/generated/YGIntrinsicSizeTest.test.ts b/javascript/tests/generated/YGIntrinsicSizeTest.test.ts
index b0f27c05f1..b6367b6134 100644
--- a/javascript/tests/generated/YGIntrinsicSizeTest.test.ts
+++ b/javascript/tests/generated/YGIntrinsicSizeTest.test.ts
@@ -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<>
+ * @generated SignedSource<>
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGIntrinsicSizeTest.html
*/
@@ -544,3 +544,2033 @@ test('contains_inner_text_max_height', () => {
config.free();
}
});
+test('max_content_width', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ try {
+ root = Yoga.Node.create(config);
+ root.setFlexDirection(FlexDirection.Row);
+ root.setPositionType(PositionType.Absolute);
+ root.setFlexWrap(Wrap.Wrap);
+ root.setWidth("max-content");
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setWidth(50);
+ root_child0.setHeight(50);
+ root.insertChild(root_child0, 0);
+
+ const root_child1 = Yoga.Node.create(config);
+ root_child1.setWidth(100);
+ root_child1.setHeight(50);
+ root.insertChild(root_child1, 1);
+
+ const root_child2 = Yoga.Node.create(config);
+ root_child2.setWidth(25);
+ root_child2.setHeight(50);
+ 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(175);
+ expect(root.getComputedHeight()).toBe(50);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(50);
+ expect(root_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child1.getComputedLeft()).toBe(50);
+ expect(root_child1.getComputedTop()).toBe(0);
+ expect(root_child1.getComputedWidth()).toBe(100);
+ expect(root_child1.getComputedHeight()).toBe(50);
+
+ expect(root_child2.getComputedLeft()).toBe(150);
+ expect(root_child2.getComputedTop()).toBe(0);
+ expect(root_child2.getComputedWidth()).toBe(25);
+ expect(root_child2.getComputedHeight()).toBe(50);
+
+ root.calculateLayout(undefined, undefined, Direction.RTL);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(0);
+ expect(root.getComputedWidth()).toBe(175);
+ expect(root.getComputedHeight()).toBe(50);
+
+ expect(root_child0.getComputedLeft()).toBe(125);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(50);
+ expect(root_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child1.getComputedLeft()).toBe(25);
+ expect(root_child1.getComputedTop()).toBe(0);
+ expect(root_child1.getComputedWidth()).toBe(100);
+ expect(root_child1.getComputedHeight()).toBe(50);
+
+ expect(root_child2.getComputedLeft()).toBe(0);
+ expect(root_child2.getComputedTop()).toBe(0);
+ expect(root_child2.getComputedWidth()).toBe(25);
+ expect(root_child2.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('fit_content_width', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ try {
+ root = Yoga.Node.create(config);
+ root.setWidth(90);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setFlexDirection(FlexDirection.Row);
+ root_child0.setFlexWrap(Wrap.Wrap);
+ root_child0.setWidth("fit-content");
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setWidth(50);
+ root_child0_child0.setHeight(50);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child1 = Yoga.Node.create(config);
+ root_child0_child1.setWidth(100);
+ root_child0_child1.setHeight(50);
+ root_child0.insertChild(root_child0_child1, 1);
+
+ const root_child0_child2 = Yoga.Node.create(config);
+ root_child0_child2.setWidth(25);
+ root_child0_child2.setHeight(50);
+ root_child0.insertChild(root_child0_child2, 2);
+ root.calculateLayout(undefined, undefined, Direction.LTR);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(0);
+ expect(root.getComputedWidth()).toBe(90);
+ expect(root.getComputedHeight()).toBe(150);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(100);
+ expect(root_child0.getComputedHeight()).toBe(150);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child1.getComputedLeft()).toBe(0);
+ expect(root_child0_child1.getComputedTop()).toBe(50);
+ expect(root_child0_child1.getComputedWidth()).toBe(100);
+ expect(root_child0_child1.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child2.getComputedLeft()).toBe(0);
+ expect(root_child0_child2.getComputedTop()).toBe(100);
+ expect(root_child0_child2.getComputedWidth()).toBe(25);
+ expect(root_child0_child2.getComputedHeight()).toBe(50);
+
+ root.calculateLayout(undefined, undefined, Direction.RTL);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(0);
+ expect(root.getComputedWidth()).toBe(90);
+ expect(root.getComputedHeight()).toBe(150);
+
+ expect(root_child0.getComputedLeft()).toBe(-10);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(100);
+ expect(root_child0.getComputedHeight()).toBe(150);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(50);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child1.getComputedLeft()).toBe(0);
+ expect(root_child0_child1.getComputedTop()).toBe(50);
+ expect(root_child0_child1.getComputedWidth()).toBe(100);
+ expect(root_child0_child1.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child2.getComputedLeft()).toBe(75);
+ expect(root_child0_child2.getComputedTop()).toBe(100);
+ expect(root_child0_child2.getComputedWidth()).toBe(25);
+ expect(root_child0_child2.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('stretch_width', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ try {
+ root = Yoga.Node.create(config);
+ root.setWidth(500);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setFlexDirection(FlexDirection.Row);
+ root_child0.setFlexWrap(Wrap.Wrap);
+ root_child0.setWidth("stretch");
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setWidth(50);
+ root_child0_child0.setHeight(50);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child1 = Yoga.Node.create(config);
+ root_child0_child1.setWidth(100);
+ root_child0_child1.setHeight(50);
+ root_child0.insertChild(root_child0_child1, 1);
+
+ const root_child0_child2 = Yoga.Node.create(config);
+ root_child0_child2.setWidth(25);
+ root_child0_child2.setHeight(50);
+ root_child0.insertChild(root_child0_child2, 2);
+ root.calculateLayout(undefined, undefined, Direction.LTR);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(150);
+ expect(root.getComputedWidth()).toBe(500);
+ expect(root.getComputedHeight()).toBe(50);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(500);
+ expect(root_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child1.getComputedLeft()).toBe(50);
+ expect(root_child0_child1.getComputedTop()).toBe(0);
+ expect(root_child0_child1.getComputedWidth()).toBe(100);
+ expect(root_child0_child1.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child2.getComputedLeft()).toBe(150);
+ expect(root_child0_child2.getComputedTop()).toBe(0);
+ expect(root_child0_child2.getComputedWidth()).toBe(25);
+ expect(root_child0_child2.getComputedHeight()).toBe(50);
+
+ root.calculateLayout(undefined, undefined, Direction.RTL);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(150);
+ expect(root.getComputedWidth()).toBe(500);
+ expect(root.getComputedHeight()).toBe(50);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(500);
+ expect(root_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(450);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child1.getComputedLeft()).toBe(350);
+ expect(root_child0_child1.getComputedTop()).toBe(0);
+ expect(root_child0_child1.getComputedWidth()).toBe(100);
+ expect(root_child0_child1.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child2.getComputedLeft()).toBe(325);
+ expect(root_child0_child2.getComputedTop()).toBe(0);
+ expect(root_child0_child2.getComputedWidth()).toBe(25);
+ expect(root_child0_child2.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test('max_content_height', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ try {
+ root = Yoga.Node.create(config);
+ root.setPositionType(PositionType.Absolute);
+ root.setFlexWrap(Wrap.Wrap);
+ root.setHeight("max-content");
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setWidth(50);
+ root_child0.setHeight(50);
+ root.insertChild(root_child0, 0);
+
+ const root_child1 = Yoga.Node.create(config);
+ root_child1.setWidth(50);
+ root_child1.setHeight(100);
+ root.insertChild(root_child1, 1);
+
+ const root_child2 = Yoga.Node.create(config);
+ root_child2.setWidth(50);
+ root_child2.setHeight(25);
+ 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(50);
+ expect(root.getComputedHeight()).toBe(175);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(50);
+ expect(root_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child1.getComputedLeft()).toBe(0);
+ expect(root_child1.getComputedTop()).toBe(50);
+ expect(root_child1.getComputedWidth()).toBe(50);
+ expect(root_child1.getComputedHeight()).toBe(100);
+
+ expect(root_child2.getComputedLeft()).toBe(0);
+ expect(root_child2.getComputedTop()).toBe(150);
+ expect(root_child2.getComputedWidth()).toBe(50);
+ expect(root_child2.getComputedHeight()).toBe(25);
+
+ root.calculateLayout(undefined, undefined, Direction.RTL);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(0);
+ expect(root.getComputedWidth()).toBe(50);
+ expect(root.getComputedHeight()).toBe(175);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(50);
+ expect(root_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child1.getComputedLeft()).toBe(0);
+ expect(root_child1.getComputedTop()).toBe(50);
+ expect(root_child1.getComputedWidth()).toBe(50);
+ expect(root_child1.getComputedHeight()).toBe(100);
+
+ expect(root_child2.getComputedLeft()).toBe(0);
+ expect(root_child2.getComputedTop()).toBe(150);
+ expect(root_child2.getComputedWidth()).toBe(50);
+ expect(root_child2.getComputedHeight()).toBe(25);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('fit_content_height', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ try {
+ root = Yoga.Node.create(config);
+ root.setHeight(90);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setFlexWrap(Wrap.Wrap);
+ root_child0.setHeight("fit-content");
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setWidth(50);
+ root_child0_child0.setHeight(50);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child1 = Yoga.Node.create(config);
+ root_child0_child1.setWidth(50);
+ root_child0_child1.setHeight(100);
+ root_child0.insertChild(root_child0_child1, 1);
+
+ const root_child0_child2 = Yoga.Node.create(config);
+ root_child0_child2.setWidth(50);
+ root_child0_child2.setHeight(25);
+ 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.getComputedWidth()).toBe(500);
+ expect(root.getComputedHeight()).toBe(90);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(500);
+ expect(root_child0.getComputedHeight()).toBe(175);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child1.getComputedLeft()).toBe(0);
+ expect(root_child0_child1.getComputedTop()).toBe(50);
+ expect(root_child0_child1.getComputedWidth()).toBe(50);
+ expect(root_child0_child1.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child2.getComputedLeft()).toBe(0);
+ expect(root_child0_child2.getComputedTop()).toBe(150);
+ expect(root_child0_child2.getComputedWidth()).toBe(50);
+ expect(root_child0_child2.getComputedHeight()).toBe(25);
+
+ root.calculateLayout(undefined, undefined, Direction.RTL);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(200);
+ expect(root.getComputedWidth()).toBe(500);
+ expect(root.getComputedHeight()).toBe(90);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(500);
+ expect(root_child0.getComputedHeight()).toBe(175);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(450);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child1.getComputedLeft()).toBe(450);
+ expect(root_child0_child1.getComputedTop()).toBe(50);
+ expect(root_child0_child1.getComputedWidth()).toBe(50);
+ expect(root_child0_child1.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child2.getComputedLeft()).toBe(450);
+ expect(root_child0_child2.getComputedTop()).toBe(150);
+ expect(root_child0_child2.getComputedWidth()).toBe(50);
+ expect(root_child0_child2.getComputedHeight()).toBe(25);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('stretch_height', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ try {
+ root = Yoga.Node.create(config);
+ root.setHeight(500);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setFlexWrap(Wrap.Wrap);
+ root_child0.setHeight("stretch");
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setWidth(50);
+ root_child0_child0.setHeight(50);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child1 = Yoga.Node.create(config);
+ root_child0_child1.setWidth(50);
+ root_child0_child1.setHeight(100);
+ root_child0.insertChild(root_child0_child1, 1);
+
+ const root_child0_child2 = Yoga.Node.create(config);
+ root_child0_child2.setWidth(50);
+ root_child0_child2.setHeight(25);
+ root_child0.insertChild(root_child0_child2, 2);
+ root.calculateLayout(undefined, undefined, Direction.LTR);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(290);
+ expect(root.getComputedWidth()).toBe(500);
+ expect(root.getComputedHeight()).toBe(500);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(500);
+ expect(root_child0.getComputedHeight()).toBe(175);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child1.getComputedLeft()).toBe(0);
+ expect(root_child0_child1.getComputedTop()).toBe(50);
+ expect(root_child0_child1.getComputedWidth()).toBe(50);
+ expect(root_child0_child1.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child2.getComputedLeft()).toBe(0);
+ expect(root_child0_child2.getComputedTop()).toBe(150);
+ expect(root_child0_child2.getComputedWidth()).toBe(50);
+ expect(root_child0_child2.getComputedHeight()).toBe(25);
+
+ root.calculateLayout(undefined, undefined, Direction.RTL);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(290);
+ expect(root.getComputedWidth()).toBe(500);
+ expect(root.getComputedHeight()).toBe(500);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(500);
+ expect(root_child0.getComputedHeight()).toBe(175);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(450);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child1.getComputedLeft()).toBe(450);
+ expect(root_child0_child1.getComputedTop()).toBe(50);
+ expect(root_child0_child1.getComputedWidth()).toBe(50);
+ expect(root_child0_child1.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child2.getComputedLeft()).toBe(450);
+ expect(root_child0_child2.getComputedTop()).toBe(150);
+ expect(root_child0_child2.getComputedWidth()).toBe(50);
+ expect(root_child0_child2.getComputedHeight()).toBe(25);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test('max_content_flex_basis_column', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ try {
+ root = Yoga.Node.create(config);
+ root.setPositionType(PositionType.Absolute);
+ root.setFlexWrap(Wrap.Wrap);
+ root.setFlexBasis("max-content");
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setWidth(50);
+ root_child0.setHeight(50);
+ root.insertChild(root_child0, 0);
+
+ const root_child1 = Yoga.Node.create(config);
+ root_child1.setWidth(50);
+ root_child1.setHeight(100);
+ root.insertChild(root_child1, 1);
+
+ const root_child2 = Yoga.Node.create(config);
+ root_child2.setWidth(50);
+ root_child2.setHeight(25);
+ 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(50);
+ expect(root.getComputedHeight()).toBe(175);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(50);
+ expect(root_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child1.getComputedLeft()).toBe(0);
+ expect(root_child1.getComputedTop()).toBe(50);
+ expect(root_child1.getComputedWidth()).toBe(50);
+ expect(root_child1.getComputedHeight()).toBe(100);
+
+ expect(root_child2.getComputedLeft()).toBe(0);
+ expect(root_child2.getComputedTop()).toBe(150);
+ expect(root_child2.getComputedWidth()).toBe(50);
+ expect(root_child2.getComputedHeight()).toBe(25);
+
+ root.calculateLayout(undefined, undefined, Direction.RTL);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(0);
+ expect(root.getComputedWidth()).toBe(50);
+ expect(root.getComputedHeight()).toBe(175);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(50);
+ expect(root_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child1.getComputedLeft()).toBe(0);
+ expect(root_child1.getComputedTop()).toBe(50);
+ expect(root_child1.getComputedWidth()).toBe(50);
+ expect(root_child1.getComputedHeight()).toBe(100);
+
+ expect(root_child2.getComputedLeft()).toBe(0);
+ expect(root_child2.getComputedTop()).toBe(150);
+ expect(root_child2.getComputedWidth()).toBe(50);
+ expect(root_child2.getComputedHeight()).toBe(25);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('fit_content_flex_basis_column', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ try {
+ root = Yoga.Node.create(config);
+ root.setHeight(90);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setFlexWrap(Wrap.Wrap);
+ root_child0.setFlexBasis("fit-content");
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setWidth(50);
+ root_child0_child0.setHeight(50);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child1 = Yoga.Node.create(config);
+ root_child0_child1.setWidth(50);
+ root_child0_child1.setHeight(100);
+ root_child0.insertChild(root_child0_child1, 1);
+
+ const root_child0_child2 = Yoga.Node.create(config);
+ root_child0_child2.setWidth(50);
+ root_child0_child2.setHeight(25);
+ root_child0.insertChild(root_child0_child2, 2);
+ root.calculateLayout(undefined, undefined, Direction.LTR);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(790);
+ expect(root.getComputedWidth()).toBe(500);
+ expect(root.getComputedHeight()).toBe(90);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(500);
+ expect(root_child0.getComputedHeight()).toBe(175);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child1.getComputedLeft()).toBe(0);
+ expect(root_child0_child1.getComputedTop()).toBe(50);
+ expect(root_child0_child1.getComputedWidth()).toBe(50);
+ expect(root_child0_child1.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child2.getComputedLeft()).toBe(0);
+ expect(root_child0_child2.getComputedTop()).toBe(150);
+ expect(root_child0_child2.getComputedWidth()).toBe(50);
+ expect(root_child0_child2.getComputedHeight()).toBe(25);
+
+ root.calculateLayout(undefined, undefined, Direction.RTL);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(790);
+ expect(root.getComputedWidth()).toBe(500);
+ expect(root.getComputedHeight()).toBe(90);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(500);
+ expect(root_child0.getComputedHeight()).toBe(175);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(450);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child1.getComputedLeft()).toBe(450);
+ expect(root_child0_child1.getComputedTop()).toBe(50);
+ expect(root_child0_child1.getComputedWidth()).toBe(50);
+ expect(root_child0_child1.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child2.getComputedLeft()).toBe(450);
+ expect(root_child0_child2.getComputedTop()).toBe(150);
+ expect(root_child0_child2.getComputedWidth()).toBe(50);
+ expect(root_child0_child2.getComputedHeight()).toBe(25);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('stretch_flex_basis_column', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ try {
+ root = Yoga.Node.create(config);
+ root.setHeight(500);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setFlexWrap(Wrap.Wrap);
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setWidth(50);
+ root_child0_child0.setHeight(50);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child1 = Yoga.Node.create(config);
+ root_child0_child1.setWidth(50);
+ root_child0_child1.setHeight(100);
+ root_child0.insertChild(root_child0_child1, 1);
+
+ const root_child0_child2 = Yoga.Node.create(config);
+ root_child0_child2.setWidth(50);
+ root_child0_child2.setHeight(25);
+ root_child0.insertChild(root_child0_child2, 2);
+ root.calculateLayout(undefined, undefined, Direction.LTR);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(880);
+ expect(root.getComputedWidth()).toBe(500);
+ expect(root.getComputedHeight()).toBe(500);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(500);
+ expect(root_child0.getComputedHeight()).toBe(175);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child1.getComputedLeft()).toBe(0);
+ expect(root_child0_child1.getComputedTop()).toBe(50);
+ expect(root_child0_child1.getComputedWidth()).toBe(50);
+ expect(root_child0_child1.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child2.getComputedLeft()).toBe(0);
+ expect(root_child0_child2.getComputedTop()).toBe(150);
+ expect(root_child0_child2.getComputedWidth()).toBe(50);
+ expect(root_child0_child2.getComputedHeight()).toBe(25);
+
+ root.calculateLayout(undefined, undefined, Direction.RTL);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(880);
+ expect(root.getComputedWidth()).toBe(500);
+ expect(root.getComputedHeight()).toBe(500);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(500);
+ expect(root_child0.getComputedHeight()).toBe(175);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(450);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child1.getComputedLeft()).toBe(450);
+ expect(root_child0_child1.getComputedTop()).toBe(50);
+ expect(root_child0_child1.getComputedWidth()).toBe(50);
+ expect(root_child0_child1.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child2.getComputedLeft()).toBe(450);
+ expect(root_child0_child2.getComputedTop()).toBe(150);
+ expect(root_child0_child2.getComputedWidth()).toBe(50);
+ expect(root_child0_child2.getComputedHeight()).toBe(25);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test('max_content_flex_basis_row', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ try {
+ root = Yoga.Node.create(config);
+ root.setFlexDirection(FlexDirection.Row);
+ root.setPositionType(PositionType.Absolute);
+ root.setFlexWrap(Wrap.Wrap);
+ root.setFlexBasis("max-content");
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setWidth(50);
+ root_child0.setHeight(50);
+ root.insertChild(root_child0, 0);
+
+ const root_child1 = Yoga.Node.create(config);
+ root_child1.setWidth(100);
+ root_child1.setHeight(500);
+ root.insertChild(root_child1, 1);
+
+ const root_child2 = Yoga.Node.create(config);
+ root_child2.setWidth(25);
+ root_child2.setHeight(50);
+ 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(175);
+ expect(root.getComputedHeight()).toBe(500);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(50);
+ expect(root_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child1.getComputedLeft()).toBe(50);
+ expect(root_child1.getComputedTop()).toBe(0);
+ expect(root_child1.getComputedWidth()).toBe(100);
+ expect(root_child1.getComputedHeight()).toBe(500);
+
+ expect(root_child2.getComputedLeft()).toBe(150);
+ expect(root_child2.getComputedTop()).toBe(0);
+ expect(root_child2.getComputedWidth()).toBe(25);
+ expect(root_child2.getComputedHeight()).toBe(50);
+
+ root.calculateLayout(undefined, undefined, Direction.RTL);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(0);
+ expect(root.getComputedWidth()).toBe(175);
+ expect(root.getComputedHeight()).toBe(500);
+
+ expect(root_child0.getComputedLeft()).toBe(125);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(50);
+ expect(root_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child1.getComputedLeft()).toBe(25);
+ expect(root_child1.getComputedTop()).toBe(0);
+ expect(root_child1.getComputedWidth()).toBe(100);
+ expect(root_child1.getComputedHeight()).toBe(500);
+
+ expect(root_child2.getComputedLeft()).toBe(0);
+ expect(root_child2.getComputedTop()).toBe(0);
+ expect(root_child2.getComputedWidth()).toBe(25);
+ expect(root_child2.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('fit_content_flex_basis_row', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ try {
+ root = Yoga.Node.create(config);
+ root.setWidth(90);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setFlexDirection(FlexDirection.Row);
+ root_child0.setFlexWrap(Wrap.Wrap);
+ root_child0.setFlexBasis("fit-content");
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setWidth(50);
+ root_child0_child0.setHeight(50);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child1 = Yoga.Node.create(config);
+ root_child0_child1.setWidth(100);
+ root_child0_child1.setHeight(50);
+ root_child0.insertChild(root_child0_child1, 1);
+
+ const root_child0_child2 = Yoga.Node.create(config);
+ root_child0_child2.setWidth(25);
+ root_child0_child2.setHeight(50);
+ root_child0.insertChild(root_child0_child2, 2);
+ root.calculateLayout(undefined, undefined, Direction.LTR);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(1380);
+ expect(root.getComputedWidth()).toBe(90);
+ expect(root.getComputedHeight()).toBe(150);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(90);
+ expect(root_child0.getComputedHeight()).toBe(150);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child1.getComputedLeft()).toBe(0);
+ expect(root_child0_child1.getComputedTop()).toBe(50);
+ expect(root_child0_child1.getComputedWidth()).toBe(100);
+ expect(root_child0_child1.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child2.getComputedLeft()).toBe(0);
+ expect(root_child0_child2.getComputedTop()).toBe(100);
+ expect(root_child0_child2.getComputedWidth()).toBe(25);
+ expect(root_child0_child2.getComputedHeight()).toBe(50);
+
+ root.calculateLayout(undefined, undefined, Direction.RTL);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(1380);
+ expect(root.getComputedWidth()).toBe(90);
+ expect(root.getComputedHeight()).toBe(150);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(90);
+ expect(root_child0.getComputedHeight()).toBe(150);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(40);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child1.getComputedLeft()).toBe(-10);
+ expect(root_child0_child1.getComputedTop()).toBe(50);
+ expect(root_child0_child1.getComputedWidth()).toBe(100);
+ expect(root_child0_child1.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child2.getComputedLeft()).toBe(65);
+ expect(root_child0_child2.getComputedTop()).toBe(100);
+ expect(root_child0_child2.getComputedWidth()).toBe(25);
+ expect(root_child0_child2.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('stretch_flex_basis_row', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ try {
+ root = Yoga.Node.create(config);
+ root.setWidth(500);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setFlexDirection(FlexDirection.Row);
+ root_child0.setFlexWrap(Wrap.Wrap);
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setWidth(50);
+ root_child0_child0.setHeight(50);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child1 = Yoga.Node.create(config);
+ root_child0_child1.setWidth(100);
+ root_child0_child1.setHeight(50);
+ root_child0.insertChild(root_child0_child1, 1);
+
+ const root_child0_child2 = Yoga.Node.create(config);
+ root_child0_child2.setWidth(25);
+ root_child0_child2.setHeight(50);
+ root_child0.insertChild(root_child0_child2, 2);
+ root.calculateLayout(undefined, undefined, Direction.LTR);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(1530);
+ expect(root.getComputedWidth()).toBe(500);
+ expect(root.getComputedHeight()).toBe(50);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(500);
+ expect(root_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child1.getComputedLeft()).toBe(50);
+ expect(root_child0_child1.getComputedTop()).toBe(0);
+ expect(root_child0_child1.getComputedWidth()).toBe(100);
+ expect(root_child0_child1.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child2.getComputedLeft()).toBe(150);
+ expect(root_child0_child2.getComputedTop()).toBe(0);
+ expect(root_child0_child2.getComputedWidth()).toBe(25);
+ expect(root_child0_child2.getComputedHeight()).toBe(50);
+
+ root.calculateLayout(undefined, undefined, Direction.RTL);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(1530);
+ expect(root.getComputedWidth()).toBe(500);
+ expect(root.getComputedHeight()).toBe(50);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(500);
+ expect(root_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(450);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child1.getComputedLeft()).toBe(350);
+ expect(root_child0_child1.getComputedTop()).toBe(0);
+ expect(root_child0_child1.getComputedWidth()).toBe(100);
+ expect(root_child0_child1.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child2.getComputedLeft()).toBe(325);
+ expect(root_child0_child2.getComputedTop()).toBe(0);
+ expect(root_child0_child2.getComputedWidth()).toBe(25);
+ expect(root_child0_child2.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('max_content_max_width', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ try {
+ root = Yoga.Node.create(config);
+ root.setFlexDirection(FlexDirection.Row);
+ root.setPositionType(PositionType.Absolute);
+ root.setFlexWrap(Wrap.Wrap);
+ root.setWidth(200);
+ root.setMaxWidth("max-content");
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setWidth(50);
+ root_child0.setHeight(50);
+ root.insertChild(root_child0, 0);
+
+ const root_child1 = Yoga.Node.create(config);
+ root_child1.setWidth(100);
+ root_child1.setHeight(50);
+ root.insertChild(root_child1, 1);
+
+ const root_child2 = Yoga.Node.create(config);
+ root_child2.setWidth(25);
+ root_child2.setHeight(50);
+ 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(175);
+ expect(root.getComputedHeight()).toBe(50);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(50);
+ expect(root_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child1.getComputedLeft()).toBe(50);
+ expect(root_child1.getComputedTop()).toBe(0);
+ expect(root_child1.getComputedWidth()).toBe(100);
+ expect(root_child1.getComputedHeight()).toBe(50);
+
+ expect(root_child2.getComputedLeft()).toBe(150);
+ expect(root_child2.getComputedTop()).toBe(0);
+ expect(root_child2.getComputedWidth()).toBe(25);
+ expect(root_child2.getComputedHeight()).toBe(50);
+
+ root.calculateLayout(undefined, undefined, Direction.RTL);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(0);
+ expect(root.getComputedWidth()).toBe(175);
+ expect(root.getComputedHeight()).toBe(50);
+
+ expect(root_child0.getComputedLeft()).toBe(125);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(50);
+ expect(root_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child1.getComputedLeft()).toBe(25);
+ expect(root_child1.getComputedTop()).toBe(0);
+ expect(root_child1.getComputedWidth()).toBe(100);
+ expect(root_child1.getComputedHeight()).toBe(50);
+
+ expect(root_child2.getComputedLeft()).toBe(0);
+ expect(root_child2.getComputedTop()).toBe(0);
+ expect(root_child2.getComputedWidth()).toBe(25);
+ expect(root_child2.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('fit_content_max_width', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ try {
+ root = Yoga.Node.create(config);
+ root.setWidth(90);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setFlexDirection(FlexDirection.Row);
+ root_child0.setFlexWrap(Wrap.Wrap);
+ root_child0.setWidth(110);
+ root_child0.setMaxWidth("fit-content");
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setWidth(50);
+ root_child0_child0.setHeight(50);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child1 = Yoga.Node.create(config);
+ root_child0_child1.setWidth(100);
+ root_child0_child1.setHeight(50);
+ root_child0.insertChild(root_child0_child1, 1);
+
+ const root_child0_child2 = Yoga.Node.create(config);
+ root_child0_child2.setWidth(25);
+ root_child0_child2.setHeight(50);
+ root_child0.insertChild(root_child0_child2, 2);
+ root.calculateLayout(undefined, undefined, Direction.LTR);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(1580);
+ expect(root.getComputedWidth()).toBe(90);
+ expect(root.getComputedHeight()).toBe(150);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(100);
+ expect(root_child0.getComputedHeight()).toBe(150);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child1.getComputedLeft()).toBe(0);
+ expect(root_child0_child1.getComputedTop()).toBe(50);
+ expect(root_child0_child1.getComputedWidth()).toBe(100);
+ expect(root_child0_child1.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child2.getComputedLeft()).toBe(0);
+ expect(root_child0_child2.getComputedTop()).toBe(100);
+ expect(root_child0_child2.getComputedWidth()).toBe(25);
+ expect(root_child0_child2.getComputedHeight()).toBe(50);
+
+ root.calculateLayout(undefined, undefined, Direction.RTL);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(1580);
+ expect(root.getComputedWidth()).toBe(90);
+ expect(root.getComputedHeight()).toBe(150);
+
+ expect(root_child0.getComputedLeft()).toBe(-10);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(100);
+ expect(root_child0.getComputedHeight()).toBe(150);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(50);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child1.getComputedLeft()).toBe(0);
+ expect(root_child0_child1.getComputedTop()).toBe(50);
+ expect(root_child0_child1.getComputedWidth()).toBe(100);
+ expect(root_child0_child1.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child2.getComputedLeft()).toBe(75);
+ expect(root_child0_child2.getComputedTop()).toBe(100);
+ expect(root_child0_child2.getComputedWidth()).toBe(25);
+ expect(root_child0_child2.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('stretch_max_width', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ try {
+ root = Yoga.Node.create(config);
+ root.setWidth(500);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setFlexDirection(FlexDirection.Row);
+ root_child0.setFlexWrap(Wrap.Wrap);
+ root_child0.setWidth(600);
+ root_child0.setMaxWidth("stretch");
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setWidth(50);
+ root_child0_child0.setHeight(50);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child1 = Yoga.Node.create(config);
+ root_child0_child1.setWidth(100);
+ root_child0_child1.setHeight(50);
+ root_child0.insertChild(root_child0_child1, 1);
+
+ const root_child0_child2 = Yoga.Node.create(config);
+ root_child0_child2.setWidth(25);
+ root_child0_child2.setHeight(50);
+ root_child0.insertChild(root_child0_child2, 2);
+ root.calculateLayout(undefined, undefined, Direction.LTR);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(1730);
+ expect(root.getComputedWidth()).toBe(500);
+ expect(root.getComputedHeight()).toBe(50);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(500);
+ expect(root_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child1.getComputedLeft()).toBe(50);
+ expect(root_child0_child1.getComputedTop()).toBe(0);
+ expect(root_child0_child1.getComputedWidth()).toBe(100);
+ expect(root_child0_child1.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child2.getComputedLeft()).toBe(150);
+ expect(root_child0_child2.getComputedTop()).toBe(0);
+ expect(root_child0_child2.getComputedWidth()).toBe(25);
+ expect(root_child0_child2.getComputedHeight()).toBe(50);
+
+ root.calculateLayout(undefined, undefined, Direction.RTL);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(1730);
+ expect(root.getComputedWidth()).toBe(500);
+ expect(root.getComputedHeight()).toBe(50);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(500);
+ expect(root_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(450);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child1.getComputedLeft()).toBe(350);
+ expect(root_child0_child1.getComputedTop()).toBe(0);
+ expect(root_child0_child1.getComputedWidth()).toBe(100);
+ expect(root_child0_child1.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child2.getComputedLeft()).toBe(325);
+ expect(root_child0_child2.getComputedTop()).toBe(0);
+ expect(root_child0_child2.getComputedWidth()).toBe(25);
+ expect(root_child0_child2.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('max_content_min_width', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ try {
+ root = Yoga.Node.create(config);
+ root.setFlexDirection(FlexDirection.Row);
+ root.setPositionType(PositionType.Absolute);
+ root.setFlexWrap(Wrap.Wrap);
+ root.setWidth(100);
+ root.setMinWidth("max-content");
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setWidth(50);
+ root_child0.setHeight(50);
+ root.insertChild(root_child0, 0);
+
+ const root_child1 = Yoga.Node.create(config);
+ root_child1.setWidth(100);
+ root_child1.setHeight(50);
+ root.insertChild(root_child1, 1);
+
+ const root_child2 = Yoga.Node.create(config);
+ root_child2.setWidth(25);
+ root_child2.setHeight(50);
+ 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(175);
+ expect(root.getComputedHeight()).toBe(50);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(50);
+ expect(root_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child1.getComputedLeft()).toBe(50);
+ expect(root_child1.getComputedTop()).toBe(0);
+ expect(root_child1.getComputedWidth()).toBe(100);
+ expect(root_child1.getComputedHeight()).toBe(50);
+
+ expect(root_child2.getComputedLeft()).toBe(150);
+ expect(root_child2.getComputedTop()).toBe(0);
+ expect(root_child2.getComputedWidth()).toBe(25);
+ expect(root_child2.getComputedHeight()).toBe(50);
+
+ root.calculateLayout(undefined, undefined, Direction.RTL);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(0);
+ expect(root.getComputedWidth()).toBe(175);
+ expect(root.getComputedHeight()).toBe(50);
+
+ expect(root_child0.getComputedLeft()).toBe(125);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(50);
+ expect(root_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child1.getComputedLeft()).toBe(25);
+ expect(root_child1.getComputedTop()).toBe(0);
+ expect(root_child1.getComputedWidth()).toBe(100);
+ expect(root_child1.getComputedHeight()).toBe(50);
+
+ expect(root_child2.getComputedLeft()).toBe(0);
+ expect(root_child2.getComputedTop()).toBe(0);
+ expect(root_child2.getComputedWidth()).toBe(25);
+ expect(root_child2.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('fit_content_min_width', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ try {
+ root = Yoga.Node.create(config);
+ root.setWidth(90);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setFlexDirection(FlexDirection.Row);
+ root_child0.setFlexWrap(Wrap.Wrap);
+ root_child0.setWidth(90);
+ root_child0.setMinWidth("fit-content");
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setWidth(50);
+ root_child0_child0.setHeight(50);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child1 = Yoga.Node.create(config);
+ root_child0_child1.setWidth(100);
+ root_child0_child1.setHeight(50);
+ root_child0.insertChild(root_child0_child1, 1);
+
+ const root_child0_child2 = Yoga.Node.create(config);
+ root_child0_child2.setWidth(25);
+ root_child0_child2.setHeight(50);
+ root_child0.insertChild(root_child0_child2, 2);
+ root.calculateLayout(undefined, undefined, Direction.LTR);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(1780);
+ expect(root.getComputedWidth()).toBe(90);
+ expect(root.getComputedHeight()).toBe(150);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(100);
+ expect(root_child0.getComputedHeight()).toBe(150);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child1.getComputedLeft()).toBe(0);
+ expect(root_child0_child1.getComputedTop()).toBe(50);
+ expect(root_child0_child1.getComputedWidth()).toBe(100);
+ expect(root_child0_child1.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child2.getComputedLeft()).toBe(0);
+ expect(root_child0_child2.getComputedTop()).toBe(100);
+ expect(root_child0_child2.getComputedWidth()).toBe(25);
+ expect(root_child0_child2.getComputedHeight()).toBe(50);
+
+ root.calculateLayout(undefined, undefined, Direction.RTL);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(1780);
+ expect(root.getComputedWidth()).toBe(90);
+ expect(root.getComputedHeight()).toBe(150);
+
+ expect(root_child0.getComputedLeft()).toBe(-10);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(100);
+ expect(root_child0.getComputedHeight()).toBe(150);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(50);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child1.getComputedLeft()).toBe(0);
+ expect(root_child0_child1.getComputedTop()).toBe(50);
+ expect(root_child0_child1.getComputedWidth()).toBe(100);
+ expect(root_child0_child1.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child2.getComputedLeft()).toBe(75);
+ expect(root_child0_child2.getComputedTop()).toBe(100);
+ expect(root_child0_child2.getComputedWidth()).toBe(25);
+ expect(root_child0_child2.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('stretch_min_width', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ try {
+ root = Yoga.Node.create(config);
+ root.setWidth(500);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setFlexDirection(FlexDirection.Row);
+ root_child0.setFlexWrap(Wrap.Wrap);
+ root_child0.setWidth(400);
+ root_child0.setMinWidth("stretch");
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setWidth(50);
+ root_child0_child0.setHeight(50);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child1 = Yoga.Node.create(config);
+ root_child0_child1.setWidth(100);
+ root_child0_child1.setHeight(50);
+ root_child0.insertChild(root_child0_child1, 1);
+
+ const root_child0_child2 = Yoga.Node.create(config);
+ root_child0_child2.setWidth(25);
+ root_child0_child2.setHeight(50);
+ root_child0.insertChild(root_child0_child2, 2);
+ root.calculateLayout(undefined, undefined, Direction.LTR);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(1930);
+ expect(root.getComputedWidth()).toBe(500);
+ expect(root.getComputedHeight()).toBe(50);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(500);
+ expect(root_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child1.getComputedLeft()).toBe(50);
+ expect(root_child0_child1.getComputedTop()).toBe(0);
+ expect(root_child0_child1.getComputedWidth()).toBe(100);
+ expect(root_child0_child1.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child2.getComputedLeft()).toBe(150);
+ expect(root_child0_child2.getComputedTop()).toBe(0);
+ expect(root_child0_child2.getComputedWidth()).toBe(25);
+ expect(root_child0_child2.getComputedHeight()).toBe(50);
+
+ root.calculateLayout(undefined, undefined, Direction.RTL);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(1930);
+ expect(root.getComputedWidth()).toBe(500);
+ expect(root.getComputedHeight()).toBe(50);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(500);
+ expect(root_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(450);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child1.getComputedLeft()).toBe(350);
+ expect(root_child0_child1.getComputedTop()).toBe(0);
+ expect(root_child0_child1.getComputedWidth()).toBe(100);
+ expect(root_child0_child1.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child2.getComputedLeft()).toBe(325);
+ expect(root_child0_child2.getComputedTop()).toBe(0);
+ expect(root_child0_child2.getComputedWidth()).toBe(25);
+ expect(root_child0_child2.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('max_content_max_height', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ try {
+ root = Yoga.Node.create(config);
+ root.setPositionType(PositionType.Absolute);
+ root.setFlexWrap(Wrap.Wrap);
+ root.setHeight(200);
+ root.setMaxHeight("max-content");
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setWidth(50);
+ root_child0.setHeight(50);
+ root.insertChild(root_child0, 0);
+
+ const root_child1 = Yoga.Node.create(config);
+ root_child1.setWidth(50);
+ root_child1.setHeight(100);
+ root.insertChild(root_child1, 1);
+
+ const root_child2 = Yoga.Node.create(config);
+ root_child2.setWidth(50);
+ root_child2.setHeight(25);
+ 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(50);
+ expect(root.getComputedHeight()).toBe(175);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(50);
+ expect(root_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child1.getComputedLeft()).toBe(0);
+ expect(root_child1.getComputedTop()).toBe(50);
+ expect(root_child1.getComputedWidth()).toBe(50);
+ expect(root_child1.getComputedHeight()).toBe(100);
+
+ expect(root_child2.getComputedLeft()).toBe(0);
+ expect(root_child2.getComputedTop()).toBe(150);
+ expect(root_child2.getComputedWidth()).toBe(50);
+ expect(root_child2.getComputedHeight()).toBe(25);
+
+ root.calculateLayout(undefined, undefined, Direction.RTL);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(0);
+ expect(root.getComputedWidth()).toBe(50);
+ expect(root.getComputedHeight()).toBe(175);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(50);
+ expect(root_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child1.getComputedLeft()).toBe(0);
+ expect(root_child1.getComputedTop()).toBe(50);
+ expect(root_child1.getComputedWidth()).toBe(50);
+ expect(root_child1.getComputedHeight()).toBe(100);
+
+ expect(root_child2.getComputedLeft()).toBe(0);
+ expect(root_child2.getComputedTop()).toBe(150);
+ expect(root_child2.getComputedWidth()).toBe(50);
+ expect(root_child2.getComputedHeight()).toBe(25);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('fit_content_max_height', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ try {
+ root = Yoga.Node.create(config);
+ root.setHeight(90);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setFlexWrap(Wrap.Wrap);
+ root_child0.setHeight(110);
+ root_child0.setMaxHeight("fit-content");
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setWidth(50);
+ root_child0_child0.setHeight(50);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child1 = Yoga.Node.create(config);
+ root_child0_child1.setWidth(50);
+ root_child0_child1.setHeight(100);
+ root_child0.insertChild(root_child0_child1, 1);
+
+ const root_child0_child2 = Yoga.Node.create(config);
+ root_child0_child2.setWidth(50);
+ root_child0_child2.setHeight(25);
+ root_child0.insertChild(root_child0_child2, 2);
+ root.calculateLayout(undefined, undefined, Direction.LTR);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(1980);
+ expect(root.getComputedWidth()).toBe(500);
+ expect(root.getComputedHeight()).toBe(90);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(500);
+ expect(root_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child1.getComputedLeft()).toBe(50);
+ expect(root_child0_child1.getComputedTop()).toBe(0);
+ expect(root_child0_child1.getComputedWidth()).toBe(50);
+ expect(root_child0_child1.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child2.getComputedLeft()).toBe(100);
+ expect(root_child0_child2.getComputedTop()).toBe(0);
+ expect(root_child0_child2.getComputedWidth()).toBe(50);
+ expect(root_child0_child2.getComputedHeight()).toBe(25);
+
+ root.calculateLayout(undefined, undefined, Direction.RTL);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(1980);
+ expect(root.getComputedWidth()).toBe(500);
+ expect(root.getComputedHeight()).toBe(90);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(500);
+ expect(root_child0.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(450);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child1.getComputedLeft()).toBe(400);
+ expect(root_child0_child1.getComputedTop()).toBe(0);
+ expect(root_child0_child1.getComputedWidth()).toBe(50);
+ expect(root_child0_child1.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child2.getComputedLeft()).toBe(350);
+ expect(root_child0_child2.getComputedTop()).toBe(0);
+ expect(root_child0_child2.getComputedWidth()).toBe(50);
+ expect(root_child0_child2.getComputedHeight()).toBe(25);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('stretch_max_height', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ try {
+ root = Yoga.Node.create(config);
+ root.setHeight(500);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setFlexWrap(Wrap.Wrap);
+ root_child0.setHeight(600);
+ root_child0.setMaxHeight("stretch");
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setWidth(50);
+ root_child0_child0.setHeight(50);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child1 = Yoga.Node.create(config);
+ root_child0_child1.setWidth(50);
+ root_child0_child1.setHeight(100);
+ root_child0.insertChild(root_child0_child1, 1);
+
+ const root_child0_child2 = Yoga.Node.create(config);
+ root_child0_child2.setWidth(50);
+ root_child0_child2.setHeight(25);
+ root_child0.insertChild(root_child0_child2, 2);
+ root.calculateLayout(undefined, undefined, Direction.LTR);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(2070);
+ expect(root.getComputedWidth()).toBe(500);
+ expect(root.getComputedHeight()).toBe(500);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(500);
+ expect(root_child0.getComputedHeight()).toBe(600);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child1.getComputedLeft()).toBe(0);
+ expect(root_child0_child1.getComputedTop()).toBe(50);
+ expect(root_child0_child1.getComputedWidth()).toBe(50);
+ expect(root_child0_child1.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child2.getComputedLeft()).toBe(0);
+ expect(root_child0_child2.getComputedTop()).toBe(150);
+ expect(root_child0_child2.getComputedWidth()).toBe(50);
+ expect(root_child0_child2.getComputedHeight()).toBe(25);
+
+ root.calculateLayout(undefined, undefined, Direction.RTL);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(2070);
+ expect(root.getComputedWidth()).toBe(500);
+ expect(root.getComputedHeight()).toBe(500);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(500);
+ expect(root_child0.getComputedHeight()).toBe(600);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(450);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child1.getComputedLeft()).toBe(450);
+ expect(root_child0_child1.getComputedTop()).toBe(50);
+ expect(root_child0_child1.getComputedWidth()).toBe(50);
+ expect(root_child0_child1.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child2.getComputedLeft()).toBe(450);
+ expect(root_child0_child2.getComputedTop()).toBe(150);
+ expect(root_child0_child2.getComputedWidth()).toBe(50);
+ expect(root_child0_child2.getComputedHeight()).toBe(25);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('max_content_min_height', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ try {
+ root = Yoga.Node.create(config);
+ root.setPositionType(PositionType.Absolute);
+ root.setFlexWrap(Wrap.Wrap);
+ root.setHeight(100);
+ root.setMinHeight("max-content");
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setWidth(50);
+ root_child0.setHeight(50);
+ root.insertChild(root_child0, 0);
+
+ const root_child1 = Yoga.Node.create(config);
+ root_child1.setWidth(50);
+ root_child1.setHeight(100);
+ root.insertChild(root_child1, 1);
+
+ const root_child2 = Yoga.Node.create(config);
+ root_child2.setWidth(50);
+ root_child2.setHeight(25);
+ 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(50);
+ expect(root.getComputedHeight()).toBe(175);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(50);
+ expect(root_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child1.getComputedLeft()).toBe(0);
+ expect(root_child1.getComputedTop()).toBe(50);
+ expect(root_child1.getComputedWidth()).toBe(50);
+ expect(root_child1.getComputedHeight()).toBe(100);
+
+ expect(root_child2.getComputedLeft()).toBe(0);
+ expect(root_child2.getComputedTop()).toBe(150);
+ expect(root_child2.getComputedWidth()).toBe(50);
+ expect(root_child2.getComputedHeight()).toBe(25);
+
+ root.calculateLayout(undefined, undefined, Direction.RTL);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(0);
+ expect(root.getComputedWidth()).toBe(50);
+ expect(root.getComputedHeight()).toBe(175);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(50);
+ expect(root_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child1.getComputedLeft()).toBe(0);
+ expect(root_child1.getComputedTop()).toBe(50);
+ expect(root_child1.getComputedWidth()).toBe(50);
+ expect(root_child1.getComputedHeight()).toBe(100);
+
+ expect(root_child2.getComputedLeft()).toBe(0);
+ expect(root_child2.getComputedTop()).toBe(150);
+ expect(root_child2.getComputedWidth()).toBe(50);
+ expect(root_child2.getComputedHeight()).toBe(25);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('fit_content_min_height', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ try {
+ root = Yoga.Node.create(config);
+ root.setHeight(90);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setFlexWrap(Wrap.Wrap);
+ root_child0.setHeight(90);
+ root_child0.setMinHeight("fit-content");
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setWidth(50);
+ root_child0_child0.setHeight(50);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child1 = Yoga.Node.create(config);
+ root_child0_child1.setWidth(50);
+ root_child0_child1.setHeight(100);
+ root_child0.insertChild(root_child0_child1, 1);
+
+ const root_child0_child2 = Yoga.Node.create(config);
+ root_child0_child2.setWidth(50);
+ root_child0_child2.setHeight(25);
+ root_child0.insertChild(root_child0_child2, 2);
+ root.calculateLayout(undefined, undefined, Direction.LTR);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(2570);
+ expect(root.getComputedWidth()).toBe(500);
+ expect(root.getComputedHeight()).toBe(90);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(500);
+ expect(root_child0.getComputedHeight()).toBe(175);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child1.getComputedLeft()).toBe(0);
+ expect(root_child0_child1.getComputedTop()).toBe(50);
+ expect(root_child0_child1.getComputedWidth()).toBe(50);
+ expect(root_child0_child1.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child2.getComputedLeft()).toBe(0);
+ expect(root_child0_child2.getComputedTop()).toBe(150);
+ expect(root_child0_child2.getComputedWidth()).toBe(50);
+ expect(root_child0_child2.getComputedHeight()).toBe(25);
+
+ root.calculateLayout(undefined, undefined, Direction.RTL);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(2570);
+ expect(root.getComputedWidth()).toBe(500);
+ expect(root.getComputedHeight()).toBe(90);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(500);
+ expect(root_child0.getComputedHeight()).toBe(175);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(450);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child1.getComputedLeft()).toBe(450);
+ expect(root_child0_child1.getComputedTop()).toBe(50);
+ expect(root_child0_child1.getComputedWidth()).toBe(50);
+ expect(root_child0_child1.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child2.getComputedLeft()).toBe(450);
+ expect(root_child0_child2.getComputedTop()).toBe(150);
+ expect(root_child0_child2.getComputedWidth()).toBe(50);
+ expect(root_child0_child2.getComputedHeight()).toBe(25);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test.skip('stretch_min_height', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ try {
+ root = Yoga.Node.create(config);
+ root.setHeight(500);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setFlexWrap(Wrap.Wrap);
+ root_child0.setHeight(400);
+ root_child0.setMinHeight("stretch");
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setWidth(50);
+ root_child0_child0.setHeight(50);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child1 = Yoga.Node.create(config);
+ root_child0_child1.setWidth(50);
+ root_child0_child1.setHeight(100);
+ root_child0.insertChild(root_child0_child1, 1);
+
+ const root_child0_child2 = Yoga.Node.create(config);
+ root_child0_child2.setWidth(50);
+ root_child0_child2.setHeight(25);
+ root_child0.insertChild(root_child0_child2, 2);
+ root.calculateLayout(undefined, undefined, Direction.LTR);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(2660);
+ expect(root.getComputedWidth()).toBe(500);
+ expect(root.getComputedHeight()).toBe(500);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(500);
+ expect(root_child0.getComputedHeight()).toBe(400);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child1.getComputedLeft()).toBe(0);
+ expect(root_child0_child1.getComputedTop()).toBe(50);
+ expect(root_child0_child1.getComputedWidth()).toBe(50);
+ expect(root_child0_child1.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child2.getComputedLeft()).toBe(0);
+ expect(root_child0_child2.getComputedTop()).toBe(150);
+ expect(root_child0_child2.getComputedWidth()).toBe(50);
+ expect(root_child0_child2.getComputedHeight()).toBe(25);
+
+ root.calculateLayout(undefined, undefined, Direction.RTL);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(2660);
+ expect(root.getComputedWidth()).toBe(500);
+ expect(root.getComputedHeight()).toBe(500);
+
+ expect(root_child0.getComputedLeft()).toBe(0);
+ expect(root_child0.getComputedTop()).toBe(0);
+ expect(root_child0.getComputedWidth()).toBe(500);
+ expect(root_child0.getComputedHeight()).toBe(400);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(450);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0.getComputedHeight()).toBe(50);
+
+ expect(root_child0_child1.getComputedLeft()).toBe(450);
+ expect(root_child0_child1.getComputedTop()).toBe(50);
+ expect(root_child0_child1.getComputedWidth()).toBe(50);
+ expect(root_child0_child1.getComputedHeight()).toBe(100);
+
+ expect(root_child0_child2.getComputedLeft()).toBe(450);
+ expect(root_child0_child2.getComputedTop()).toBe(150);
+ expect(root_child0_child2.getComputedWidth()).toBe(50);
+ expect(root_child0_child2.getComputedHeight()).toBe(25);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
diff --git a/tests/generated/YGIntrinsicSizeTest.cpp b/tests/generated/YGIntrinsicSizeTest.cpp
index 6fa3fd67b7..268964c9ac 100644
--- a/tests/generated/YGIntrinsicSizeTest.cpp
+++ b/tests/generated/YGIntrinsicSizeTest.cpp
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* clang-format off
- * @generated SignedSource<<112035ed7718c93e29fefe32eb90f7d5>>
+ * @generated SignedSource<<7a5bad4cb091610dd7998a52fd7ea1cf>>
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGIntrinsicSizeTest.html
*/
@@ -495,3 +495,1977 @@ TEST(YogaTest, contains_inner_text_max_height) {
YGConfigFree(config);
}
+
+TEST(YogaTest, max_content_width) {
+ YGConfigRef config = YGConfigNew();
+
+ YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
+ YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
+ YGNodeStyleSetFlexWrap(root, YGWrapWrap);
+ YGNodeStyleSetWidthMaxContent(root);
+
+ YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0, 50);
+ YGNodeStyleSetHeight(root_child0, 50);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ YGNodeRef root_child1 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child1, 100);
+ YGNodeStyleSetHeight(root_child1, 50);
+ YGNodeInsertChild(root, root_child1, 1);
+
+ YGNodeRef root_child2 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child2, 25);
+ YGNodeStyleSetHeight(root_child2, 50);
+ YGNodeInsertChild(root, root_child2, 2);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(175, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child2));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child2));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(175, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(125, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child2));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, fit_content_width) {
+ GTEST_SKIP();
+
+ YGConfigRef config = YGConfigNew();
+
+ YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root, 90);
+
+ YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow);
+ YGNodeStyleSetFlexWrap(root_child0, YGWrapWrap);
+ YGNodeStyleSetWidthFitContent(root_child0);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0, 50);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child1, 100);
+ YGNodeStyleSetHeight(root_child0_child1, 50);
+ YGNodeInsertChild(root_child0, root_child0_child1, 1);
+
+ YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child2, 25);
+ YGNodeStyleSetHeight(root_child0_child2, 50);
+ YGNodeInsertChild(root_child0, root_child0_child2, 2);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(90, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child2));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child2));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(90, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(-10, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child1));
+
+ ASSERT_FLOAT_EQ(75, YGNodeLayoutGetLeft(root_child0_child2));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child2));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, stretch_width) {
+ GTEST_SKIP();
+
+ YGConfigRef config = YGConfigNew();
+
+ YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root, 500);
+
+ YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow);
+ YGNodeStyleSetFlexWrap(root_child0, YGWrapWrap);
+ YGNodeStyleSetWidthStretch(root_child0);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0, 50);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child1, 100);
+ YGNodeStyleSetHeight(root_child0_child1, 50);
+ YGNodeInsertChild(root_child0, root_child0_child1, 1);
+
+ YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child2, 25);
+ YGNodeStyleSetHeight(root_child0_child2, 50);
+ YGNodeInsertChild(root_child0, root_child0_child2, 2);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0_child1));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child1));
+
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child0_child2));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child2));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(350, YGNodeLayoutGetLeft(root_child0_child1));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child1));
+
+ ASSERT_FLOAT_EQ(325, YGNodeLayoutGetLeft(root_child0_child2));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child2));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, max_content_height) {
+ YGConfigRef config = YGConfigNew();
+
+ YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
+ YGNodeStyleSetFlexWrap(root, YGWrapWrap);
+ YGNodeStyleSetHeightMaxContent(root);
+
+ YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0, 50);
+ YGNodeStyleSetHeight(root_child0, 50);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ YGNodeRef root_child1 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child1, 50);
+ YGNodeStyleSetHeight(root_child1, 100);
+ YGNodeInsertChild(root, root_child1, 1);
+
+ YGNodeRef root_child2 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child2, 50);
+ YGNodeStyleSetHeight(root_child2, 25);
+ YGNodeInsertChild(root, root_child2, 2);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(175, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child2));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(175, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child2));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, fit_content_height) {
+ GTEST_SKIP();
+
+ YGConfigRef config = YGConfigNew();
+
+ YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeStyleSetHeight(root, 90);
+
+ YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetFlexWrap(root_child0, YGWrapWrap);
+ YGNodeStyleSetHeightFitContent(root_child0);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0, 50);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child1, 50);
+ YGNodeStyleSetHeight(root_child0_child1, 100);
+ YGNodeInsertChild(root_child0, root_child0_child1, 1);
+
+ YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child2, 50);
+ YGNodeStyleSetHeight(root_child0_child2, 25);
+ YGNodeInsertChild(root_child0, root_child0_child2, 2);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(90, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(175, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child2));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child2));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(90, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(175, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1));
+
+ ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child2));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child2));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, stretch_height) {
+ GTEST_SKIP();
+
+ YGConfigRef config = YGConfigNew();
+
+ YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeStyleSetHeight(root, 500);
+
+ YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetFlexWrap(root_child0, YGWrapWrap);
+ YGNodeStyleSetHeightStretch(root_child0);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0, 50);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child1, 50);
+ YGNodeStyleSetHeight(root_child0_child1, 100);
+ YGNodeInsertChild(root_child0, root_child0_child1, 1);
+
+ YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child2, 50);
+ YGNodeStyleSetHeight(root_child0_child2, 25);
+ YGNodeInsertChild(root_child0, root_child0_child2, 2);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(290, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(175, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child2));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child2));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(290, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(175, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1));
+
+ ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child2));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child2));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, max_content_flex_basis_column) {
+ YGConfigRef config = YGConfigNew();
+
+ YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
+ YGNodeStyleSetFlexWrap(root, YGWrapWrap);
+ YGNodeStyleSetFlexBasisMaxContent(root);
+
+ YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0, 50);
+ YGNodeStyleSetHeight(root_child0, 50);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ YGNodeRef root_child1 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child1, 50);
+ YGNodeStyleSetHeight(root_child1, 100);
+ YGNodeInsertChild(root, root_child1, 1);
+
+ YGNodeRef root_child2 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child2, 50);
+ YGNodeStyleSetHeight(root_child2, 25);
+ YGNodeInsertChild(root, root_child2, 2);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(175, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child2));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(175, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child2));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, fit_content_flex_basis_column) {
+ GTEST_SKIP();
+
+ YGConfigRef config = YGConfigNew();
+
+ YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeStyleSetHeight(root, 90);
+
+ YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetFlexWrap(root_child0, YGWrapWrap);
+ YGNodeStyleSetFlexBasisFitContent(root_child0);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0, 50);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child1, 50);
+ YGNodeStyleSetHeight(root_child0_child1, 100);
+ YGNodeInsertChild(root_child0, root_child0_child1, 1);
+
+ YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child2, 50);
+ YGNodeStyleSetHeight(root_child0_child2, 25);
+ YGNodeInsertChild(root_child0, root_child0_child2, 2);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(790, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(90, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(175, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child2));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child2));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(790, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(90, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(175, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1));
+
+ ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child2));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child2));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, stretch_flex_basis_column) {
+ GTEST_SKIP();
+
+ YGConfigRef config = YGConfigNew();
+
+ YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeStyleSetHeight(root, 500);
+
+ YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetFlexWrap(root_child0, YGWrapWrap);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0, 50);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child1, 50);
+ YGNodeStyleSetHeight(root_child0_child1, 100);
+ YGNodeInsertChild(root_child0, root_child0_child1, 1);
+
+ YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child2, 50);
+ YGNodeStyleSetHeight(root_child0_child2, 25);
+ YGNodeInsertChild(root_child0, root_child0_child2, 2);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(880, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(175, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child2));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child2));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(880, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(175, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1));
+
+ ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child2));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child2));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, max_content_flex_basis_row) {
+ YGConfigRef config = YGConfigNew();
+
+ YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
+ YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
+ YGNodeStyleSetFlexWrap(root, YGWrapWrap);
+ YGNodeStyleSetFlexBasisMaxContent(root);
+
+ YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0, 50);
+ YGNodeStyleSetHeight(root_child0, 50);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ YGNodeRef root_child1 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child1, 100);
+ YGNodeStyleSetHeight(root_child1, 500);
+ YGNodeInsertChild(root, root_child1, 1);
+
+ YGNodeRef root_child2 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child2, 25);
+ YGNodeStyleSetHeight(root_child2, 50);
+ YGNodeInsertChild(root, root_child2, 2);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(175, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child2));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child2));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(175, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(125, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child2));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, fit_content_flex_basis_row) {
+ GTEST_SKIP();
+
+ YGConfigRef config = YGConfigNew();
+
+ YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root, 90);
+
+ YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow);
+ YGNodeStyleSetFlexWrap(root_child0, YGWrapWrap);
+ YGNodeStyleSetFlexBasisFitContent(root_child0);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0, 50);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child1, 100);
+ YGNodeStyleSetHeight(root_child0_child1, 50);
+ YGNodeInsertChild(root_child0, root_child0_child1, 1);
+
+ YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child2, 25);
+ YGNodeStyleSetHeight(root_child0_child2, 50);
+ YGNodeInsertChild(root_child0, root_child0_child2, 2);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(1380, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(90, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(90, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child2));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child2));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(1380, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(90, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(90, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(40, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(-10, YGNodeLayoutGetLeft(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child1));
+
+ ASSERT_FLOAT_EQ(65, YGNodeLayoutGetLeft(root_child0_child2));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child2));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, stretch_flex_basis_row) {
+ GTEST_SKIP();
+
+ YGConfigRef config = YGConfigNew();
+
+ YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root, 500);
+
+ YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow);
+ YGNodeStyleSetFlexWrap(root_child0, YGWrapWrap);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0, 50);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child1, 100);
+ YGNodeStyleSetHeight(root_child0_child1, 50);
+ YGNodeInsertChild(root_child0, root_child0_child1, 1);
+
+ YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child2, 25);
+ YGNodeStyleSetHeight(root_child0_child2, 50);
+ YGNodeInsertChild(root_child0, root_child0_child2, 2);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(1530, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0_child1));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child1));
+
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child0_child2));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child2));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(1530, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(350, YGNodeLayoutGetLeft(root_child0_child1));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child1));
+
+ ASSERT_FLOAT_EQ(325, YGNodeLayoutGetLeft(root_child0_child2));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child2));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, max_content_max_width) {
+ GTEST_SKIP();
+
+ YGConfigRef config = YGConfigNew();
+
+ YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
+ YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
+ YGNodeStyleSetFlexWrap(root, YGWrapWrap);
+ YGNodeStyleSetWidth(root, 200);
+ YGNodeStyleSetMaxWidthMaxContent(root);
+
+ YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0, 50);
+ YGNodeStyleSetHeight(root_child0, 50);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ YGNodeRef root_child1 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child1, 100);
+ YGNodeStyleSetHeight(root_child1, 50);
+ YGNodeInsertChild(root, root_child1, 1);
+
+ YGNodeRef root_child2 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child2, 25);
+ YGNodeStyleSetHeight(root_child2, 50);
+ YGNodeInsertChild(root, root_child2, 2);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(175, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child2));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child2));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(175, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(125, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child2));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, fit_content_max_width) {
+ GTEST_SKIP();
+
+ YGConfigRef config = YGConfigNew();
+
+ YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root, 90);
+
+ YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow);
+ YGNodeStyleSetFlexWrap(root_child0, YGWrapWrap);
+ YGNodeStyleSetWidth(root_child0, 110);
+ YGNodeStyleSetMaxWidthFitContent(root_child0);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0, 50);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child1, 100);
+ YGNodeStyleSetHeight(root_child0_child1, 50);
+ YGNodeInsertChild(root_child0, root_child0_child1, 1);
+
+ YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child2, 25);
+ YGNodeStyleSetHeight(root_child0_child2, 50);
+ YGNodeInsertChild(root_child0, root_child0_child2, 2);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(1580, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(90, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child2));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child2));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(1580, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(90, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(-10, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child1));
+
+ ASSERT_FLOAT_EQ(75, YGNodeLayoutGetLeft(root_child0_child2));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child2));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, stretch_max_width) {
+ GTEST_SKIP();
+
+ YGConfigRef config = YGConfigNew();
+
+ YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root, 500);
+
+ YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow);
+ YGNodeStyleSetFlexWrap(root_child0, YGWrapWrap);
+ YGNodeStyleSetWidth(root_child0, 600);
+ YGNodeStyleSetMaxWidthStretch(root_child0);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0, 50);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child1, 100);
+ YGNodeStyleSetHeight(root_child0_child1, 50);
+ YGNodeInsertChild(root_child0, root_child0_child1, 1);
+
+ YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child2, 25);
+ YGNodeStyleSetHeight(root_child0_child2, 50);
+ YGNodeInsertChild(root_child0, root_child0_child2, 2);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(1730, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0_child1));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child1));
+
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child0_child2));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child2));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(1730, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(350, YGNodeLayoutGetLeft(root_child0_child1));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child1));
+
+ ASSERT_FLOAT_EQ(325, YGNodeLayoutGetLeft(root_child0_child2));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child2));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, max_content_min_width) {
+ GTEST_SKIP();
+
+ YGConfigRef config = YGConfigNew();
+
+ YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
+ YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
+ YGNodeStyleSetFlexWrap(root, YGWrapWrap);
+ YGNodeStyleSetWidth(root, 100);
+ YGNodeStyleSetMinWidthMaxContent(root);
+
+ YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0, 50);
+ YGNodeStyleSetHeight(root_child0, 50);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ YGNodeRef root_child1 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child1, 100);
+ YGNodeStyleSetHeight(root_child1, 50);
+ YGNodeInsertChild(root, root_child1, 1);
+
+ YGNodeRef root_child2 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child2, 25);
+ YGNodeStyleSetHeight(root_child2, 50);
+ YGNodeInsertChild(root, root_child2, 2);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(175, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child2));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child2));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(175, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(125, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child2));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, fit_content_min_width) {
+ GTEST_SKIP();
+
+ YGConfigRef config = YGConfigNew();
+
+ YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root, 90);
+
+ YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow);
+ YGNodeStyleSetFlexWrap(root_child0, YGWrapWrap);
+ YGNodeStyleSetWidth(root_child0, 90);
+ YGNodeStyleSetMinWidthFitContent(root_child0);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0, 50);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child1, 100);
+ YGNodeStyleSetHeight(root_child0_child1, 50);
+ YGNodeInsertChild(root_child0, root_child0_child1, 1);
+
+ YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child2, 25);
+ YGNodeStyleSetHeight(root_child0_child2, 50);
+ YGNodeInsertChild(root_child0, root_child0_child2, 2);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(1780, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(90, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child2));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child2));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(1780, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(90, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(-10, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child1));
+
+ ASSERT_FLOAT_EQ(75, YGNodeLayoutGetLeft(root_child0_child2));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child2));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, stretch_min_width) {
+ GTEST_SKIP();
+
+ YGConfigRef config = YGConfigNew();
+
+ YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root, 500);
+
+ YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow);
+ YGNodeStyleSetFlexWrap(root_child0, YGWrapWrap);
+ YGNodeStyleSetWidth(root_child0, 400);
+ YGNodeStyleSetMinWidthStretch(root_child0);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0, 50);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child1, 100);
+ YGNodeStyleSetHeight(root_child0_child1, 50);
+ YGNodeInsertChild(root_child0, root_child0_child1, 1);
+
+ YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child2, 25);
+ YGNodeStyleSetHeight(root_child0_child2, 50);
+ YGNodeInsertChild(root_child0, root_child0_child2, 2);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(1930, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0_child1));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child1));
+
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child0_child2));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child2));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(1930, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(350, YGNodeLayoutGetLeft(root_child0_child1));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child1));
+
+ ASSERT_FLOAT_EQ(325, YGNodeLayoutGetLeft(root_child0_child2));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child0_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child2));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, max_content_max_height) {
+ GTEST_SKIP();
+
+ YGConfigRef config = YGConfigNew();
+
+ YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
+ YGNodeStyleSetFlexWrap(root, YGWrapWrap);
+ YGNodeStyleSetHeight(root, 200);
+ YGNodeStyleSetMaxHeightMaxContent(root);
+
+ YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0, 50);
+ YGNodeStyleSetHeight(root_child0, 50);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ YGNodeRef root_child1 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child1, 50);
+ YGNodeStyleSetHeight(root_child1, 100);
+ YGNodeInsertChild(root, root_child1, 1);
+
+ YGNodeRef root_child2 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child2, 50);
+ YGNodeStyleSetHeight(root_child2, 25);
+ YGNodeInsertChild(root, root_child2, 2);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(175, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child2));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(175, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child2));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, fit_content_max_height) {
+ GTEST_SKIP();
+
+ YGConfigRef config = YGConfigNew();
+
+ YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeStyleSetHeight(root, 90);
+
+ YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetFlexWrap(root_child0, YGWrapWrap);
+ YGNodeStyleSetHeight(root_child0, 110);
+ YGNodeStyleSetMaxHeightFitContent(root_child0);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0, 50);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child1, 50);
+ YGNodeStyleSetHeight(root_child0_child1, 100);
+ YGNodeInsertChild(root_child0, root_child0_child1, 1);
+
+ YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child2, 50);
+ YGNodeStyleSetHeight(root_child0_child2, 25);
+ YGNodeInsertChild(root_child0, root_child0_child2, 2);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(1980, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(90, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0_child1));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child2));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child2));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(1980, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(90, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetLeft(root_child0_child1));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1));
+
+ ASSERT_FLOAT_EQ(350, YGNodeLayoutGetLeft(root_child0_child2));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child2));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, stretch_max_height) {
+ GTEST_SKIP();
+
+ YGConfigRef config = YGConfigNew();
+
+ YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeStyleSetHeight(root, 500);
+
+ YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetFlexWrap(root_child0, YGWrapWrap);
+ YGNodeStyleSetHeight(root_child0, 600);
+ YGNodeStyleSetMaxHeightStretch(root_child0);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0, 50);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child1, 50);
+ YGNodeStyleSetHeight(root_child0_child1, 100);
+ YGNodeInsertChild(root_child0, root_child0_child1, 1);
+
+ YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child2, 50);
+ YGNodeStyleSetHeight(root_child0_child2, 25);
+ YGNodeInsertChild(root_child0, root_child0_child2, 2);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(2070, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(600, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child2));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child2));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(2070, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(600, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1));
+
+ ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child2));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child2));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, max_content_min_height) {
+ GTEST_SKIP();
+
+ YGConfigRef config = YGConfigNew();
+
+ YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
+ YGNodeStyleSetFlexWrap(root, YGWrapWrap);
+ YGNodeStyleSetHeight(root, 100);
+ YGNodeStyleSetMinHeightMaxContent(root);
+
+ YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0, 50);
+ YGNodeStyleSetHeight(root_child0, 50);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ YGNodeRef root_child1 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child1, 50);
+ YGNodeStyleSetHeight(root_child1, 100);
+ YGNodeInsertChild(root, root_child1, 1);
+
+ YGNodeRef root_child2 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child2, 50);
+ YGNodeStyleSetHeight(root_child2, 25);
+ YGNodeInsertChild(root, root_child2, 2);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(175, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child2));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(175, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child2));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, fit_content_min_height) {
+ GTEST_SKIP();
+
+ YGConfigRef config = YGConfigNew();
+
+ YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeStyleSetHeight(root, 90);
+
+ YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetFlexWrap(root_child0, YGWrapWrap);
+ YGNodeStyleSetHeight(root_child0, 90);
+ YGNodeStyleSetMinHeightFitContent(root_child0);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0, 50);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child1, 50);
+ YGNodeStyleSetHeight(root_child0_child1, 100);
+ YGNodeInsertChild(root_child0, root_child0_child1, 1);
+
+ YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child2, 50);
+ YGNodeStyleSetHeight(root_child0_child2, 25);
+ YGNodeInsertChild(root_child0, root_child0_child2, 2);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(2570, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(90, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(175, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child2));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child2));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(2570, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(90, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(175, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1));
+
+ ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child2));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child2));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, stretch_min_height) {
+ GTEST_SKIP();
+
+ YGConfigRef config = YGConfigNew();
+
+ YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeStyleSetHeight(root, 500);
+
+ YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetFlexWrap(root_child0, YGWrapWrap);
+ YGNodeStyleSetHeight(root_child0, 400);
+ YGNodeStyleSetMinHeightStretch(root_child0);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0, 50);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child1, 50);
+ YGNodeStyleSetHeight(root_child0_child1, 100);
+ YGNodeInsertChild(root_child0, root_child0_child1, 1);
+
+ YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetWidth(root_child0_child2, 50);
+ YGNodeStyleSetHeight(root_child0_child2, 25);
+ YGNodeInsertChild(root_child0, root_child0_child2, 2);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(2660, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child2));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child2));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(2660, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(500, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(400, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child1));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child1));
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1));
+
+ ASSERT_FLOAT_EQ(450, YGNodeLayoutGetLeft(root_child0_child2));
+ ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child0_child2));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child2));
+ ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child0_child2));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}