diff --git a/gentest/fixtures/YGIntrinsicSizeTest.html b/gentest/fixtures/YGIntrinsicSizeTest.html index 587b1b8506..962b24173f 100644 --- a/gentest/fixtures/YGIntrinsicSizeTest.html +++ b/gentest/fixtures/YGIntrinsicSizeTest.html @@ -219,251 +219,3 @@ Sed at consectetur ipsum. - -
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
diff --git a/gentest/gentest-cpp.js b/gentest/gentest-cpp.js index ac9c41f659..b4d6f0872a 100644 --- a/gentest/gentest-cpp.js +++ b/gentest/gentest-cpp.js @@ -17,25 +17,13 @@ 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' || - functionSuffix == 'MaxContent' || - functionSuffix == 'FitContent' || - functionSuffix == 'Stretch' - ) { + if (functionSuffix == 'Auto') { return functionPrefix + functionSuffix + '(' + nodeName + ');'; } else { return ( @@ -175,10 +163,6 @@ 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( @@ -398,25 +382,57 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, { YGNodeStyleSetMaxHeight: { value: function (nodeName, value) { - this.push(keywordFunctionCpp('YGNodeStyleSetMaxHeight', nodeName, value)); + this.push( + 'YGNodeStyleSetMaxHeight' + + toFunctionNameCpp(value) + + '(' + + nodeName + + ', ' + + toValueCpp(value) + + ');', + ); }, }, YGNodeStyleSetMaxWidth: { value: function (nodeName, value) { - this.push(keywordFunctionCpp('YGNodeStyleSetMaxWidth', nodeName, value)); + this.push( + 'YGNodeStyleSetMaxWidth' + + toFunctionNameCpp(value) + + '(' + + nodeName + + ', ' + + toValueCpp(value) + + ');', + ); }, }, YGNodeStyleSetMinHeight: { value: function (nodeName, value) { - this.push(keywordFunctionCpp('YGNodeStyleSetMinHeight', nodeName, value)); + this.push( + 'YGNodeStyleSetMinHeight' + + toFunctionNameCpp(value) + + '(' + + nodeName + + ', ' + + toValueCpp(value) + + ');', + ); }, }, YGNodeStyleSetMinWidth: { value: function (nodeName, value) { - this.push(keywordFunctionCpp('YGNodeStyleSetMinWidth', nodeName, value)); + this.push( + 'YGNodeStyleSetMinWidth' + + toFunctionNameCpp(value) + + '(' + + nodeName + + ', ' + + toValueCpp(value) + + ');', + ); }, }, diff --git a/gentest/gentest-java.js b/gentest/gentest-java.js index bc2a587712..12e86fcee5 100644 --- a/gentest/gentest-java.js +++ b/gentest/gentest-java.js @@ -17,24 +17,13 @@ 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' || - methodSuffix == 'MaxContent' || - methodSuffix == 'FitContent' || - methodSuffix == 'Stretch' - ) { + if (methodSuffix == 'Auto') { return nodeName + '.' + methodPrefix + methodSuffix + '();'; } else { return ( @@ -216,10 +205,6 @@ 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 + ');'); @@ -375,25 +360,53 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, { YGNodeStyleSetMaxHeight: { value: function (nodeName, value) { - this.push(keywordMethod('setMaxHeight', nodeName, value)); + this.push( + nodeName + + '.setMaxHeight' + + toMethodName(value) + + '(' + + toValueJava(value) + + 'f);', + ); }, }, YGNodeStyleSetMaxWidth: { value: function (nodeName, value) { - this.push(keywordMethod('setMaxWidth', nodeName, value)); + this.push( + nodeName + + '.setMaxWidth' + + toMethodName(value) + + '(' + + toValueJava(value) + + 'f);', + ); }, }, YGNodeStyleSetMinHeight: { value: function (nodeName, value) { - this.push(keywordMethod('setMinHeight', nodeName, value)); + this.push( + nodeName + + '.setMinHeight' + + toMethodName(value) + + '(' + + toValueJava(value) + + 'f);', + ); }, }, YGNodeStyleSetMinWidth: { value: function (nodeName, value) { - this.push(keywordMethod('setMinWidth', nodeName, value)); + this.push( + nodeName + + '.setMinWidth' + + toMethodName(value) + + '(' + + toValueJava(value) + + 'f);', + ); }, }, diff --git a/gentest/gentest-javascript.js b/gentest/gentest-javascript.js index 1eac141008..4af0bc2537 100644 --- a/gentest/gentest-javascript.js +++ b/gentest/gentest-javascript.js @@ -15,9 +15,6 @@ 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; } @@ -179,10 +176,6 @@ 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 d04e3d0ded..7e56644e4e 100755 --- a/gentest/gentest.js +++ b/gentest/gentest.js @@ -654,13 +654,6 @@ 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/com/facebook/yoga/YogaNative.java b/java/com/facebook/yoga/YogaNative.java index 582bd1eb19..89ef5ef16f 100644 --- a/java/com/facebook/yoga/YogaNative.java +++ b/java/com/facebook/yoga/YogaNative.java @@ -74,9 +74,6 @@ public class YogaNative { static native void jni_YGNodeStyleSetFlexBasisJNI(long nativePointer, float flexBasis); static native void jni_YGNodeStyleSetFlexBasisPercentJNI(long nativePointer, float percent); static native void jni_YGNodeStyleSetFlexBasisAutoJNI(long nativePointer); - static native void jni_YGNodeStyleSetFlexBasisMaxContentJNI(long nativePointer); - static native void jni_YGNodeStyleSetFlexBasisFitContentJNI(long nativePointer); - static native void jni_YGNodeStyleSetFlexBasisStretchJNI(long nativePointer); static native long jni_YGNodeStyleGetMarginJNI(long nativePointer, int edge); static native void jni_YGNodeStyleSetMarginJNI(long nativePointer, int edge, float margin); static native void jni_YGNodeStyleSetMarginPercentJNI(long nativePointer, int edge, float percent); @@ -94,40 +91,22 @@ public class YogaNative { static native void jni_YGNodeStyleSetWidthJNI(long nativePointer, float width); static native void jni_YGNodeStyleSetWidthPercentJNI(long nativePointer, float percent); static native void jni_YGNodeStyleSetWidthAutoJNI(long nativePointer); - static native void jni_YGNodeStyleSetWidthMaxContentJNI(long nativePointer); - static native void jni_YGNodeStyleSetWidthFitContentJNI(long nativePointer); - static native void jni_YGNodeStyleSetWidthStretchJNI(long nativePointer); static native long jni_YGNodeStyleGetHeightJNI(long nativePointer); static native void jni_YGNodeStyleSetHeightJNI(long nativePointer, float height); static native void jni_YGNodeStyleSetHeightPercentJNI(long nativePointer, float percent); static native void jni_YGNodeStyleSetHeightAutoJNI(long nativePointer); - static native void jni_YGNodeStyleSetHeightMaxContentJNI(long nativePointer); - static native void jni_YGNodeStyleSetHeightFitContentJNI(long nativePointer); - static native void jni_YGNodeStyleSetHeightStretchJNI(long nativePointer); static native long jni_YGNodeStyleGetMinWidthJNI(long nativePointer); static native void jni_YGNodeStyleSetMinWidthJNI(long nativePointer, float minWidth); static native void jni_YGNodeStyleSetMinWidthPercentJNI(long nativePointer, float percent); - static native void jni_YGNodeStyleSetMinWidthMaxContentJNI(long nativePointer); - static native void jni_YGNodeStyleSetMinWidthFitContentJNI(long nativePointer); - static native void jni_YGNodeStyleSetMinWidthStretchJNI(long nativePointer); static native long jni_YGNodeStyleGetMinHeightJNI(long nativePointer); static native void jni_YGNodeStyleSetMinHeightJNI(long nativePointer, float minHeight); static native void jni_YGNodeStyleSetMinHeightPercentJNI(long nativePointer, float percent); - static native void jni_YGNodeStyleSetMinHeightMaxContentJNI(long nativePointer); - static native void jni_YGNodeStyleSetMinHeightFitContentJNI(long nativePointer); - static native void jni_YGNodeStyleSetMinHeightStretchJNI(long nativePointer); static native long jni_YGNodeStyleGetMaxWidthJNI(long nativePointer); static native void jni_YGNodeStyleSetMaxWidthJNI(long nativePointer, float maxWidth); static native void jni_YGNodeStyleSetMaxWidthPercentJNI(long nativePointer, float percent); - static native void jni_YGNodeStyleSetMaxWidthMaxContentJNI(long nativePointer); - static native void jni_YGNodeStyleSetMaxWidthFitContentJNI(long nativePointer); - static native void jni_YGNodeStyleSetMaxWidthStretchJNI(long nativePointer); static native long jni_YGNodeStyleGetMaxHeightJNI(long nativePointer); static native void jni_YGNodeStyleSetMaxHeightJNI(long nativePointer, float maxheight); static native void jni_YGNodeStyleSetMaxHeightPercentJNI(long nativePointer, float percent); - static native void jni_YGNodeStyleSetMaxHeightMaxContentJNI(long nativePointer); - static native void jni_YGNodeStyleSetMaxHeightFitContentJNI(long nativePointer); - static native void jni_YGNodeStyleSetMaxHeightStretchJNI(long nativePointer); static native float jni_YGNodeStyleGetAspectRatioJNI(long nativePointer); static native void jni_YGNodeStyleSetAspectRatioJNI(long nativePointer, float aspectRatio); static native float jni_YGNodeStyleGetGapJNI(long nativePointer, int gutter); diff --git a/java/com/facebook/yoga/YogaNode.java b/java/com/facebook/yoga/YogaNode.java index b683b553ca..ba07684675 100644 --- a/java/com/facebook/yoga/YogaNode.java +++ b/java/com/facebook/yoga/YogaNode.java @@ -124,12 +124,6 @@ public interface Inputs { public abstract void setFlexBasisAuto(); - public abstract void setFlexBasisMaxContent(); - - public abstract void setFlexBasisFitContent(); - - public abstract void setFlexBasisStretch(); - public abstract YogaValue getMargin(YogaEdge edge); public abstract void setMargin(YogaEdge edge, float margin); @@ -164,12 +158,6 @@ public interface Inputs { public abstract void setWidthAuto(); - public abstract void setWidthMaxContent(); - - public abstract void setWidthFitContent(); - - public abstract void setWidthStretch(); - public abstract YogaValue getHeight(); public abstract void setHeight(float height); @@ -178,60 +166,30 @@ public interface Inputs { public abstract void setHeightAuto(); - public abstract void setHeightMaxContent(); - - public abstract void setHeightFitContent(); - - public abstract void setHeightStretch(); - public abstract YogaValue getMinWidth(); public abstract void setMinWidth(float minWidth); public abstract void setMinWidthPercent(float percent); - public abstract void setMinWidthMaxContent(); - - public abstract void setMinWidthFitContent(); - - public abstract void setMinWidthStretch(); - public abstract YogaValue getMinHeight(); public abstract void setMinHeight(float minHeight); public abstract void setMinHeightPercent(float percent); - public abstract void setMinHeightMaxContent(); - - public abstract void setMinHeightFitContent(); - - public abstract void setMinHeightStretch(); - public abstract YogaValue getMaxWidth(); public abstract void setMaxWidth(float maxWidth); public abstract void setMaxWidthPercent(float percent); - public abstract void setMaxWidthMaxContent(); - - public abstract void setMaxWidthFitContent(); - - public abstract void setMaxWidthStretch(); - public abstract YogaValue getMaxHeight(); public abstract void setMaxHeight(float maxheight); public abstract void setMaxHeightPercent(float percent); - public abstract void setMaxHeightMaxContent(); - - public abstract void setMaxHeightFitContent(); - - public abstract void setMaxHeightStretch(); - public abstract float getAspectRatio(); public abstract void setAspectRatio(float aspectRatio); diff --git a/java/com/facebook/yoga/YogaNodeJNIBase.java b/java/com/facebook/yoga/YogaNodeJNIBase.java index e25872545e..a53fe74af0 100644 --- a/java/com/facebook/yoga/YogaNodeJNIBase.java +++ b/java/com/facebook/yoga/YogaNodeJNIBase.java @@ -373,18 +373,6 @@ public void setFlexBasisAuto() { YogaNative.jni_YGNodeStyleSetFlexBasisAutoJNI(mNativePointer); } - public void setFlexBasisMaxContent() { - YogaNative.jni_YGNodeStyleSetFlexBasisMaxContentJNI(mNativePointer); - } - - public void setFlexBasisFitContent() { - YogaNative.jni_YGNodeStyleSetFlexBasisFitContentJNI(mNativePointer); - } - - public void setFlexBasisStretch() { - YogaNative.jni_YGNodeStyleSetFlexBasisStretchJNI(mNativePointer); - } - public YogaValue getMargin(YogaEdge edge) { return valueFromLong(YogaNative.jni_YGNodeStyleGetMarginJNI(mNativePointer, edge.intValue())); } @@ -453,18 +441,6 @@ public void setWidthAuto() { YogaNative.jni_YGNodeStyleSetWidthAutoJNI(mNativePointer); } - public void setWidthMaxContent() { - YogaNative.jni_YGNodeStyleSetWidthMaxContentJNI(mNativePointer); - } - - public void setWidthFitContent() { - YogaNative.jni_YGNodeStyleSetWidthFitContentJNI(mNativePointer); - } - - public void setWidthStretch() { - YogaNative.jni_YGNodeStyleSetWidthStretchJNI(mNativePointer); - } - public YogaValue getHeight() { return valueFromLong(YogaNative.jni_YGNodeStyleGetHeightJNI(mNativePointer)); } @@ -481,18 +457,6 @@ public void setHeightAuto() { YogaNative.jni_YGNodeStyleSetHeightAutoJNI(mNativePointer); } - public void setHeightMaxContent() { - YogaNative.jni_YGNodeStyleSetHeightMaxContentJNI(mNativePointer); - } - - public void setHeightFitContent() { - YogaNative.jni_YGNodeStyleSetHeightFitContentJNI(mNativePointer); - } - - public void setHeightStretch() { - YogaNative.jni_YGNodeStyleSetHeightStretchJNI(mNativePointer); - } - public YogaValue getMinWidth() { return valueFromLong(YogaNative.jni_YGNodeStyleGetMinWidthJNI(mNativePointer)); } @@ -505,18 +469,6 @@ public void setMinWidthPercent(float percent) { YogaNative.jni_YGNodeStyleSetMinWidthPercentJNI(mNativePointer, percent); } - public void setMinWidthMaxContent() { - YogaNative.jni_YGNodeStyleSetMinWidthMaxContentJNI(mNativePointer); - } - - public void setMinWidthFitContent() { - YogaNative.jni_YGNodeStyleSetMinWidthFitContentJNI(mNativePointer); - } - - public void setMinWidthStretch() { - YogaNative.jni_YGNodeStyleSetMinWidthStretchJNI(mNativePointer); - } - public YogaValue getMinHeight() { return valueFromLong(YogaNative.jni_YGNodeStyleGetMinHeightJNI(mNativePointer)); } @@ -529,18 +481,6 @@ public void setMinHeightPercent(float percent) { YogaNative.jni_YGNodeStyleSetMinHeightPercentJNI(mNativePointer, percent); } - public void setMinHeightMaxContent() { - YogaNative.jni_YGNodeStyleSetMinHeightMaxContentJNI(mNativePointer); - } - - public void setMinHeightFitContent() { - YogaNative.jni_YGNodeStyleSetMinHeightFitContentJNI(mNativePointer); - } - - public void setMinHeightStretch() { - YogaNative.jni_YGNodeStyleSetMinHeightStretchJNI(mNativePointer); - } - public YogaValue getMaxWidth() { return valueFromLong(YogaNative.jni_YGNodeStyleGetMaxWidthJNI(mNativePointer)); } @@ -553,18 +493,6 @@ public void setMaxWidthPercent(float percent) { YogaNative.jni_YGNodeStyleSetMaxWidthPercentJNI(mNativePointer, percent); } - public void setMaxWidthMaxContent() { - YogaNative.jni_YGNodeStyleSetMaxWidthMaxContentJNI(mNativePointer); - } - - public void setMaxWidthFitContent() { - YogaNative.jni_YGNodeStyleSetMaxWidthFitContentJNI(mNativePointer); - } - - public void setMaxWidthStretch() { - YogaNative.jni_YGNodeStyleSetMaxWidthStretchJNI(mNativePointer); - } - public YogaValue getMaxHeight() { return valueFromLong(YogaNative.jni_YGNodeStyleGetMaxHeightJNI(mNativePointer)); } @@ -577,18 +505,6 @@ public void setMaxHeightPercent(float percent) { YogaNative.jni_YGNodeStyleSetMaxHeightPercentJNI(mNativePointer, percent); } - public void setMaxHeightMaxContent() { - YogaNative.jni_YGNodeStyleSetMaxHeightMaxContentJNI(mNativePointer); - } - - public void setMaxHeightFitContent() { - YogaNative.jni_YGNodeStyleSetMaxHeightFitContentJNI(mNativePointer); - } - - public void setMaxHeightStretch() { - YogaNative.jni_YGNodeStyleSetMaxHeightStretchJNI(mNativePointer); - } - public float getAspectRatio() { return YogaNative.jni_YGNodeStyleGetAspectRatioJNI(mNativePointer); } diff --git a/java/com/facebook/yoga/YogaProps.java b/java/com/facebook/yoga/YogaProps.java index 0cad45fa9c..c596c6a7c1 100644 --- a/java/com/facebook/yoga/YogaProps.java +++ b/java/com/facebook/yoga/YogaProps.java @@ -15,33 +15,15 @@ public interface YogaProps { void setWidthPercent(float percent); - void setWidthAuto(); - - void setWidthMaxContent(); - - void setWidthFitContent(); - - void setWidthStretch(); - void setMinWidth(float minWidth); void setMinWidthPercent(float percent); - void setMinWidthMaxContent(); - - void setMinWidthFitContent(); - - void setMinWidthStretch(); - void setMaxWidth(float maxWidth); void setMaxWidthPercent(float percent); - void setMaxWidthMaxContent(); - - void setMaxWidthFitContent(); - - void setMaxWidthStretch(); + void setWidthAuto(); /* Height properties */ @@ -49,33 +31,15 @@ public interface YogaProps { void setHeightPercent(float percent); - void setHeightAuto(); - - void setHeightMaxContent(); - - void setHeightFitContent(); - - void setHeightStretch(); - void setMinHeight(float minHeight); void setMinHeightPercent(float percent); - void setMinHeightMaxContent(); - - void setMinHeightFitContent(); - - void setMinHeightStretch(); - void setMaxHeight(float maxHeight); void setMaxHeightPercent(float percent); - void setMaxHeightMaxContent(); - - void setMaxHeightFitContent(); - - void setMaxHeightStretch(); + void setHeightAuto(); /* Margin properties */ @@ -117,12 +81,6 @@ public interface YogaProps { void setFlexBasis(float flexBasis); - void setFlexBasisMaxContent(); - - void setFlexBasisFitContent(); - - void setFlexBasisStretch(); - void setFlexDirection(YogaFlexDirection direction); void setFlexGrow(float flexGrow); diff --git a/java/jni/YGJNIVanilla.cpp b/java/jni/YGJNIVanilla.cpp index 95273836c2..6b8ed14bd6 100644 --- a/java/jni/YGJNIVanilla.cpp +++ b/java/jni/YGJNIVanilla.cpp @@ -429,28 +429,6 @@ static void jni_YGNodeCopyStyleJNI( YGNodeStyleSet##name##Auto(_jlong2YGNodeRef(nativePointer)); \ } -#define YG_NODE_JNI_STYLE_UNIT_PROP_AUTO_INTRINSIC(name) \ - YG_NODE_JNI_STYLE_UNIT_PROP_AUTO(name) \ - YG_NODE_JNI_STYLE_UNIT_INTRINSIC(name) - -#define YG_NODE_JNI_STYLE_UNIT_PROP_INTRINSIC(name) \ - YG_NODE_JNI_STYLE_UNIT_PROP(name) \ - YG_NODE_JNI_STYLE_UNIT_INTRINSIC(name) - -#define YG_NODE_JNI_STYLE_UNIT_INTRINSIC(name) \ - static void jni_YGNodeStyleSet##name##MaxContentJNI( \ - JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer) { \ - YGNodeStyleSet##name##MaxContent(_jlong2YGNodeRef(nativePointer)); \ - } \ - static void jni_YGNodeStyleSet##name##FitContentJNI( \ - JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer) { \ - YGNodeStyleSet##name##FitContent(_jlong2YGNodeRef(nativePointer)); \ - } \ - static void jni_YGNodeStyleSet##name##StretchJNI( \ - JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer) { \ - YGNodeStyleSet##name##Stretch(_jlong2YGNodeRef(nativePointer)); \ - } - #define YG_NODE_JNI_STYLE_EDGE_UNIT_PROP(name) \ static jlong jni_YGNodeStyleGet##name##JNI( \ JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer, jint edge) { \ @@ -505,13 +483,13 @@ YG_NODE_JNI_STYLE_PROP(jfloat, float, Flex); YG_NODE_JNI_STYLE_PROP(jfloat, float, FlexGrow); YG_NODE_JNI_STYLE_PROP(jfloat, float, FlexShrink); -YG_NODE_JNI_STYLE_UNIT_PROP_AUTO_INTRINSIC(FlexBasis); -YG_NODE_JNI_STYLE_UNIT_PROP_AUTO_INTRINSIC(Width); -YG_NODE_JNI_STYLE_UNIT_PROP_INTRINSIC(MinWidth); -YG_NODE_JNI_STYLE_UNIT_PROP_INTRINSIC(MaxWidth); -YG_NODE_JNI_STYLE_UNIT_PROP_AUTO_INTRINSIC(Height); -YG_NODE_JNI_STYLE_UNIT_PROP_INTRINSIC(MinHeight); -YG_NODE_JNI_STYLE_UNIT_PROP_INTRINSIC(MaxHeight); +YG_NODE_JNI_STYLE_UNIT_PROP_AUTO(FlexBasis); +YG_NODE_JNI_STYLE_UNIT_PROP_AUTO(Width); +YG_NODE_JNI_STYLE_UNIT_PROP(MinWidth); +YG_NODE_JNI_STYLE_UNIT_PROP(MaxWidth); +YG_NODE_JNI_STYLE_UNIT_PROP_AUTO(Height); +YG_NODE_JNI_STYLE_UNIT_PROP(MinHeight); +YG_NODE_JNI_STYLE_UNIT_PROP(MaxHeight); YG_NODE_JNI_STYLE_EDGE_UNIT_PROP_AUTO(Position); @@ -892,15 +870,6 @@ static JNINativeMethod methods[] = { {"jni_YGNodeStyleSetFlexBasisAutoJNI", "(J)V", (void*)jni_YGNodeStyleSetFlexBasisAutoJNI}, - {"jni_YGNodeStyleSetFlexBasisMaxContentJNI", - "(J)V", - (void*)jni_YGNodeStyleSetFlexBasisMaxContentJNI}, - {"jni_YGNodeStyleSetFlexBasisFitContentJNI", - "(J)V", - (void*)jni_YGNodeStyleSetFlexBasisFitContentJNI}, - {"jni_YGNodeStyleSetFlexBasisStretchJNI", - "(J)V", - (void*)jni_YGNodeStyleSetFlexBasisStretchJNI}, {"jni_YGNodeStyleGetMarginJNI", "(JI)J", (void*)jni_YGNodeStyleGetMarginJNI}, @@ -948,15 +917,6 @@ static JNINativeMethod methods[] = { {"jni_YGNodeStyleSetWidthAutoJNI", "(J)V", (void*)jni_YGNodeStyleSetWidthAutoJNI}, - {"jni_YGNodeStyleSetWidthMaxContentJNI", - "(J)V", - (void*)jni_YGNodeStyleSetWidthMaxContentJNI}, - {"jni_YGNodeStyleSetWidthFitContentJNI", - "(J)V", - (void*)jni_YGNodeStyleSetWidthFitContentJNI}, - {"jni_YGNodeStyleSetWidthStretchJNI", - "(J)V", - (void*)jni_YGNodeStyleSetWidthStretchJNI}, {"jni_YGNodeStyleGetHeightJNI", "(J)J", (void*)jni_YGNodeStyleGetHeightJNI}, {"jni_YGNodeStyleSetHeightJNI", "(JF)V", @@ -967,15 +927,6 @@ static JNINativeMethod methods[] = { {"jni_YGNodeStyleSetHeightAutoJNI", "(J)V", (void*)jni_YGNodeStyleSetHeightAutoJNI}, - {"jni_YGNodeStyleSetHeightMaxContentJNI", - "(J)V", - (void*)jni_YGNodeStyleSetHeightMaxContentJNI}, - {"jni_YGNodeStyleSetHeightFitContentJNI", - "(J)V", - (void*)jni_YGNodeStyleSetHeightFitContentJNI}, - {"jni_YGNodeStyleSetHeightStretchJNI", - "(J)V", - (void*)jni_YGNodeStyleSetHeightStretchJNI}, {"jni_YGNodeStyleGetMinWidthJNI", "(J)J", (void*)jni_YGNodeStyleGetMinWidthJNI}, @@ -985,15 +936,6 @@ static JNINativeMethod methods[] = { {"jni_YGNodeStyleSetMinWidthPercentJNI", "(JF)V", (void*)jni_YGNodeStyleSetMinWidthPercentJNI}, - {"jni_YGNodeStyleSetMinWidthMaxContentJNI", - "(J)V", - (void*)jni_YGNodeStyleSetMinWidthMaxContentJNI}, - {"jni_YGNodeStyleSetMinWidthFitContentJNI", - "(J)V", - (void*)jni_YGNodeStyleSetMinWidthFitContentJNI}, - {"jni_YGNodeStyleSetMinWidthStretchJNI", - "(J)V", - (void*)jni_YGNodeStyleSetMinWidthStretchJNI}, {"jni_YGNodeStyleGetMinHeightJNI", "(J)J", (void*)jni_YGNodeStyleGetMinHeightJNI}, @@ -1003,15 +945,6 @@ static JNINativeMethod methods[] = { {"jni_YGNodeStyleSetMinHeightPercentJNI", "(JF)V", (void*)jni_YGNodeStyleSetMinHeightPercentJNI}, - {"jni_YGNodeStyleSetMinHeightMaxContentJNI", - "(J)V", - (void*)jni_YGNodeStyleSetMinHeightMaxContentJNI}, - {"jni_YGNodeStyleSetMinHeightFitContentJNI", - "(J)V", - (void*)jni_YGNodeStyleSetMinHeightFitContentJNI}, - {"jni_YGNodeStyleSetMinHeightStretchJNI", - "(J)V", - (void*)jni_YGNodeStyleSetMinHeightStretchJNI}, {"jni_YGNodeStyleGetMaxWidthJNI", "(J)J", (void*)jni_YGNodeStyleGetMaxWidthJNI}, @@ -1021,15 +954,6 @@ static JNINativeMethod methods[] = { {"jni_YGNodeStyleSetMaxWidthPercentJNI", "(JF)V", (void*)jni_YGNodeStyleSetMaxWidthPercentJNI}, - {"jni_YGNodeStyleSetMaxWidthMaxContentJNI", - "(J)V", - (void*)jni_YGNodeStyleSetMaxWidthMaxContentJNI}, - {"jni_YGNodeStyleSetMaxWidthFitContentJNI", - "(J)V", - (void*)jni_YGNodeStyleSetMaxWidthFitContentJNI}, - {"jni_YGNodeStyleSetMaxWidthStretchJNI", - "(J)V", - (void*)jni_YGNodeStyleSetMaxWidthStretchJNI}, {"jni_YGNodeStyleGetMaxHeightJNI", "(J)J", (void*)jni_YGNodeStyleGetMaxHeightJNI}, @@ -1039,15 +963,6 @@ static JNINativeMethod methods[] = { {"jni_YGNodeStyleSetMaxHeightPercentJNI", "(JF)V", (void*)jni_YGNodeStyleSetMaxHeightPercentJNI}, - {"jni_YGNodeStyleSetMaxHeightMaxContentJNI", - "(J)V", - (void*)jni_YGNodeStyleSetMaxHeightMaxContentJNI}, - {"jni_YGNodeStyleSetMaxHeightFitContentJNI", - "(J)V", - (void*)jni_YGNodeStyleSetMaxHeightFitContentJNI}, - {"jni_YGNodeStyleSetMaxHeightStretchJNI", - "(J)V", - (void*)jni_YGNodeStyleSetMaxHeightStretchJNI}, {"jni_YGNodeStyleGetAspectRatioJNI", "(J)F", (void*)jni_YGNodeStyleGetAspectRatioJNI}, diff --git a/java/tests/generated/com/facebook/yoga/YGIntrinsicSizeTest.java b/java/tests/generated/com/facebook/yoga/YGIntrinsicSizeTest.java index 7ff0d0f096..26b511329a 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<<1610045e3d68262896d841906a8fe1a7>> + * @generated SignedSource<> * generated by gentest/gentest-driver.ts from gentest/fixtures/YGIntrinsicSizeTest.html */ @@ -499,1936 +499,6 @@ 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/src/Node.cpp b/javascript/src/Node.cpp index 5284ddb5b0..f5c6a86651 100644 --- a/javascript/src/Node.cpp +++ b/javascript/src/Node.cpp @@ -160,18 +160,6 @@ void Node::setFlexBasisAuto() { YGNodeStyleSetFlexBasisAuto(m_node); } -void Node::setFlexBasisMaxContent() { - YGNodeStyleSetFlexBasisMaxContent(m_node); -} - -void Node::setFlexBasisFitContent() { - YGNodeStyleSetFlexBasisFitContent(m_node); -} - -void Node::setFlexBasisStretch() { - YGNodeStyleSetFlexBasisStretch(m_node); -} - void Node::setFlexGrow(double flexGrow) { YGNodeStyleSetFlexGrow(m_node, flexGrow); } @@ -192,18 +180,6 @@ void Node::setWidthAuto() { YGNodeStyleSetWidthAuto(m_node); } -void Node::setWidthMaxContent() { - YGNodeStyleSetWidthMaxContent(m_node); -} - -void Node::setWidthFitContent() { - YGNodeStyleSetWidthFitContent(m_node); -} - -void Node::setWidthStretch() { - YGNodeStyleSetWidthStretch(m_node); -} - void Node::setHeight(double height) { YGNodeStyleSetHeight(m_node, height); } @@ -216,18 +192,6 @@ void Node::setHeightAuto() { YGNodeStyleSetHeightAuto(m_node); } -void Node::setHeightMaxContent() { - YGNodeStyleSetHeightMaxContent(m_node); -} - -void Node::setHeightFitContent() { - YGNodeStyleSetHeightFitContent(m_node); -} - -void Node::setHeightStretch() { - YGNodeStyleSetHeightStretch(m_node); -} - void Node::setMinWidth(double minWidth) { YGNodeStyleSetMinWidth(m_node, minWidth); } @@ -236,18 +200,6 @@ void Node::setMinWidthPercent(double minWidth) { YGNodeStyleSetMinWidthPercent(m_node, minWidth); } -void Node::setMinWidthMaxContent() { - YGNodeStyleSetMinWidthMaxContent(m_node); -} - -void Node::setMinWidthFitContent() { - YGNodeStyleSetMinWidthFitContent(m_node); -} - -void Node::setMinWidthStretch() { - YGNodeStyleSetMinWidthStretch(m_node); -} - void Node::setMinHeight(double minHeight) { YGNodeStyleSetMinHeight(m_node, minHeight); } @@ -256,18 +208,6 @@ void Node::setMinHeightPercent(double minHeight) { YGNodeStyleSetMinHeightPercent(m_node, minHeight); } -void Node::setMinHeightMaxContent() { - YGNodeStyleSetMinHeightMaxContent(m_node); -} - -void Node::setMinHeightFitContent() { - YGNodeStyleSetMinHeightFitContent(m_node); -} - -void Node::setMinHeightStretch() { - YGNodeStyleSetMinHeightStretch(m_node); -} - void Node::setMaxWidth(double maxWidth) { YGNodeStyleSetMaxWidth(m_node, maxWidth); } @@ -276,18 +216,6 @@ void Node::setMaxWidthPercent(double maxWidth) { YGNodeStyleSetMaxWidthPercent(m_node, maxWidth); } -void Node::setMaxWidthMaxContent() { - YGNodeStyleSetMaxWidthMaxContent(m_node); -} - -void Node::setMaxWidthFitContent() { - YGNodeStyleSetMaxWidthFitContent(m_node); -} - -void Node::setMaxWidthStretch() { - YGNodeStyleSetMaxWidthStretch(m_node); -} - void Node::setMaxHeight(double maxHeight) { YGNodeStyleSetMaxHeight(m_node, maxHeight); } @@ -296,18 +224,6 @@ void Node::setMaxHeightPercent(double maxHeight) { YGNodeStyleSetMaxHeightPercent(m_node, maxHeight); } -void Node::setMaxHeightMaxContent() { - YGNodeStyleSetMaxHeightMaxContent(m_node); -} - -void Node::setMaxHeightFitContent() { - YGNodeStyleSetMaxHeightFitContent(m_node); -} - -void Node::setMaxHeightStretch() { - YGNodeStyleSetMaxHeightStretch(m_node); -} - void Node::setAspectRatio(double aspectRatio) { YGNodeStyleSetAspectRatio(m_node, aspectRatio); } diff --git a/javascript/src/Node.h b/javascript/src/Node.h index 0ed4d1d416..c30f1d2ded 100644 --- a/javascript/src/Node.h +++ b/javascript/src/Node.h @@ -97,46 +97,25 @@ class Node { void setFlexBasis(double flexBasis); void setFlexBasisPercent(double flexBasis); void setFlexBasisAuto(); - void setFlexBasisMaxContent(); - void setFlexBasisFitContent(); - void setFlexBasisStretch(); void setFlexGrow(double flexGrow); void setFlexShrink(double flexShrink); void setWidth(double width); void setWidthPercent(double width); void setWidthAuto(); - void setWidthMaxContent(); - void setWidthFitContent(); - void setWidthStretch(); void setHeight(double height); void setHeightPercent(double height); void setHeightAuto(); - void setHeightMaxContent(); - void setHeightFitContent(); - void setHeightStretch(); void setMinWidth(double minWidth); void setMinWidthPercent(double minWidth); - void setMinWidthMaxContent(); - void setMinWidthFitContent(); - void setMinWidthStretch(); void setMinHeight(double minHeight); void setMinHeightPercent(double minHeight); - void setMinHeightMaxContent(); - void setMinHeightFitContent(); - void setMinHeightStretch(); void setMaxWidth(double maxWidth); void setMaxWidthPercent(double maxWidth); - void setMaxWidthMaxContent(); - void setMaxWidthFitContent(); - void setMaxWidthStretch(); void setMaxHeight(double maxHeight); void setMaxHeightPercent(double maxHeight); - void setMaxHeightMaxContent(); - void setMaxHeightFitContent(); - void setMaxHeightStretch(); void setAspectRatio(double aspectRatio); diff --git a/javascript/src/embind.cpp b/javascript/src/embind.cpp index a2f7202961..d1789788cf 100644 --- a/javascript/src/embind.cpp +++ b/javascript/src/embind.cpp @@ -90,46 +90,25 @@ EMSCRIPTEN_BINDINGS(YOGA_LAYOUT) { .function("setFlexBasis", &Node::setFlexBasis) .function("setFlexBasisPercent", &Node::setFlexBasisPercent) .function("setFlexBasisAuto", &Node::setFlexBasisAuto) - .function("setFlexBasisMaxContent", &Node::setFlexBasisMaxContent) - .function("setFlexBasisFitContent", &Node::setFlexBasisFitContent) - .function("setFlexBasisStretch", &Node::setFlexBasisStretch) .function("setFlexGrow", &Node::setFlexGrow) .function("setFlexShrink", &Node::setFlexShrink) .function("setWidth", &Node::setWidth) .function("setWidthPercent", &Node::setWidthPercent) .function("setWidthAuto", &Node::setWidthAuto) - .function("setWidthMaxContent", &Node::setWidthMaxContent) - .function("setWidthFitContent", &Node::setWidthFitContent) - .function("setWidthStretch", &Node::setWidthStretch) .function("setHeight", &Node::setHeight) .function("setHeightPercent", &Node::setHeightPercent) .function("setHeightAuto", &Node::setHeightAuto) - .function("setHeightMaxContent", &Node::setHeightMaxContent) - .function("setHeightFitContent", &Node::setHeightFitContent) - .function("setHeightStretch", &Node::setHeightStretch) .function("setMinWidth", &Node::setMinWidth) .function("setMinWidthPercent", &Node::setMinWidthPercent) - .function("setMinWidthMaxContent", &Node::setMinWidthMaxContent) - .function("setMinWidthFitContent", &Node::setMinWidthFitContent) - .function("setMinWidthStretch", &Node::setMinWidthStretch) .function("setMinHeight", &Node::setMinHeight) .function("setMinHeightPercent", &Node::setMinHeightPercent) - .function("setMinHeightMaxContent", &Node::setMinHeightMaxContent) - .function("setMinHeightFitContent", &Node::setMinHeightFitContent) - .function("setMinHeightStretch", &Node::setMinHeightStretch) .function("setMaxWidth", &Node::setMaxWidth) .function("setMaxWidthPercent", &Node::setMaxWidthPercent) - .function("setMaxWidthMaxContent", &Node::setMaxWidthMaxContent) - .function("setMaxWidthFitContent", &Node::setMaxWidthFitContent) - .function("setMaxWidthStretch", &Node::setMaxWidthStretch) .function("setMaxHeight", &Node::setMaxHeight) .function("setMaxHeightPercent", &Node::setMaxHeightPercent) - .function("setMaxHeightMaxContent", &Node::setMaxHeightMaxContent) - .function("setMaxHeightFitContent", &Node::setMaxHeightFitContent) - .function("setMaxHeightStretch", &Node::setMaxHeightStretch) .function("setBoxSizing", &Node::setBoxSizing) diff --git a/javascript/src/wrapAssembly.ts b/javascript/src/wrapAssembly.ts index 9b2dc1e6ec..3f91c160bf 100644 --- a/javascript/src/wrapAssembly.ts +++ b/javascript/src/wrapAssembly.ts @@ -134,41 +134,17 @@ export type Node = { setDirection(direction: Direction): void; setDisplay(display: Display): void; setFlex(flex: number | undefined): void; - setFlexBasis( - flexBasis: - | number - | 'auto' - | 'fit-content' - | 'max-content' - | 'stretch' - | `${number}%` - | undefined, - ): void; + setFlexBasis(flexBasis: number | 'auto' | `${number}%` | undefined): void; setFlexBasisPercent(flexBasis: number | undefined): void; setFlexBasisAuto(): void; - setFlexBasisFitContent(): void; - setFlexBasisMaxContent(): void; - setFlexBasisStretch(): void; setFlexDirection(flexDirection: FlexDirection): void; setFlexGrow(flexGrow: number | undefined): void; setFlexShrink(flexShrink: number | undefined): void; setFlexWrap(flexWrap: Wrap): void; - setHeight( - height: - | number - | 'auto' - | 'fit-content' - | 'max-content' - | 'stretch' - | `${number}%` - | undefined, - ): void; + setHeight(height: number | 'auto' | `${number}%` | undefined): void; setIsReferenceBaseline(isReferenceBaseline: boolean): void; setHeightAuto(): void; - setHeightFitContent(): void; - setHeightMaxContent(): void; setHeightPercent(height: number | undefined): void; - setHeightStretch(): void; setJustifyContent(justifyContent: Justify): void; setGap(gutter: Gutter, gapLength: number | `${number}%` | undefined): Value; setGapPercent(gutter: Gutter, gapLength: number | undefined): Value; @@ -178,60 +154,16 @@ export type Node = { ): void; setMarginAuto(edge: Edge): void; setMarginPercent(edge: Edge, margin: number | undefined): void; - setMaxHeight( - maxHeight: - | number - | 'fit-content' - | 'max-content' - | 'stretch' - | `${number}%` - | undefined, - ): void; - setMaxHeightFitContent(): void; - setMaxHeightMaxContent(): void; + setMaxHeight(maxHeight: number | `${number}%` | undefined): void; setMaxHeightPercent(maxHeight: number | undefined): void; - setMaxHeightStretch(): void; - setMaxWidth( - maxWidth: - | number - | 'fit-content' - | 'max-content' - | 'stretch' - | `${number}%` - | undefined, - ): void; - setMaxWidthFitContent(): void; - setMaxWidthMaxContent(): void; + setMaxWidth(maxWidth: number | `${number}%` | undefined): void; setMaxWidthPercent(maxWidth: number | undefined): void; - setMaxWidthStretch(): void; setDirtiedFunc(dirtiedFunc: DirtiedFunction | null): void; setMeasureFunc(measureFunc: MeasureFunction | null): void; - setMinHeight( - minHeight: - | number - | 'fit-content' - | 'max-content' - | 'stretch' - | `${number}%` - | undefined, - ): void; - setMinHeightFitContent(): void; - setMinHeightMaxContent(): void; + setMinHeight(minHeight: number | `${number}%` | undefined): void; setMinHeightPercent(minHeight: number | undefined): void; - setMinHeightStretch(): void; - setMinWidth( - minWidth: - | number - | 'fit-content' - | 'max-content' - | 'stretch' - | `${number}%` - | undefined, - ): void; - setMinWidthFitContent(): void; - setMinWidthMaxContent(): void; + setMinWidth(minWidth: number | `${number}%` | undefined): void; setMinWidthPercent(minWidth: number | undefined): void; - setMinWidthStretch(): void; setOverflow(overflow: Overflow): void; setPadding(edge: Edge, padding: number | `${number}%` | undefined): void; setPaddingPercent(edge: Edge, padding: number | undefined): void; @@ -240,21 +172,9 @@ export type Node = { setPositionType(positionType: PositionType): void; setPositionAuto(edge: Edge): void; setBoxSizing(boxSizing: BoxSizing): void; - setWidth( - width: - | number - | 'auto' - | 'fit-content' - | 'max-content' - | 'stretch' - | `${number}%` - | undefined, - ): void; + setWidth(width: number | 'auto' | `${number}%` | undefined): void; setWidthAuto(): void; - setWidthFitContent(): void; - setWidthMaxContent(): void; setWidthPercent(width: number | undefined): void; - setWidthStretch(): void; unsetDirtiedFunc(): void; unsetMeasureFunc(): void; setAlwaysFormsContainingBlock(alwaysFormsContainingBlock: boolean): void; @@ -300,9 +220,6 @@ export default function wrapAssembly(lib: any): Yoga { [Unit.Point]: lib.Node.prototype[fnName], [Unit.Percent]: lib.Node.prototype[`${fnName}Percent`], [Unit.Auto]: lib.Node.prototype[`${fnName}Auto`], - [Unit.MaxContent]: lib.Node.prototype[`${fnName}MaxContent`], - [Unit.FitContent]: lib.Node.prototype[`${fnName}FitContent`], - [Unit.Stretch]: lib.Node.prototype[`${fnName}Stretch`], }; patch(lib.Node.prototype, fnName, function (original, ...args) { @@ -315,15 +232,6 @@ export default function wrapAssembly(lib: any): Yoga { if (value === 'auto') { unit = Unit.Auto; asNumber = undefined; - } else if (value == 'max-content') { - unit = Unit.MaxContent; - asNumber = undefined; - } else if (value == 'fit-content') { - unit = Unit.FitContent; - asNumber = undefined; - } else if (value == 'stretch') { - unit = Unit.Stretch; - asNumber = undefined; } else if (typeof value === 'object') { unit = value.unit; asNumber = value.valueOf(); diff --git a/javascript/tests/generated/YGIntrinsicSizeTest.test.ts b/javascript/tests/generated/YGIntrinsicSizeTest.test.ts index b6367b6134..b0f27c05f1 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,2033 +544,3 @@ 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 268964c9ac..6fa3fd67b7 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<<7a5bad4cb091610dd7998a52fd7ea1cf>> + * @generated SignedSource<<112035ed7718c93e29fefe32eb90f7d5>> * generated by gentest/gentest-driver.ts from gentest/fixtures/YGIntrinsicSizeTest.html */ @@ -495,1977 +495,3 @@ 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); -} diff --git a/yoga/YGNodeStyle.cpp b/yoga/YGNodeStyle.cpp index 3f1be42e46..1309117af4 100644 --- a/yoga/YGNodeStyle.cpp +++ b/yoga/YGNodeStyle.cpp @@ -192,21 +192,6 @@ void YGNodeStyleSetFlexBasisAuto(const YGNodeRef node) { node, StyleSizeLength::ofAuto()); } -void YGNodeStyleSetFlexBasisMaxContent(const YGNodeRef node) { - updateStyle<&Style::flexBasis, &Style::setFlexBasis>( - node, StyleSizeLength::ofMaxContent()); -} - -void YGNodeStyleSetFlexBasisFitContent(const YGNodeRef node) { - updateStyle<&Style::flexBasis, &Style::setFlexBasis>( - node, StyleSizeLength::ofFitContent()); -} - -void YGNodeStyleSetFlexBasisStretch(const YGNodeRef node) { - updateStyle<&Style::flexBasis, &Style::setFlexBasis>( - node, StyleSizeLength::ofStretch()); -} - YGValue YGNodeStyleGetFlexBasis(const YGNodeConstRef node) { return (YGValue)resolveRef(node)->style().flexBasis(); } @@ -336,21 +321,6 @@ void YGNodeStyleSetWidthAuto(YGNodeRef node) { node, Dimension::Width, StyleSizeLength::ofAuto()); } -void YGNodeStyleSetWidthMaxContent(YGNodeRef node) { - updateStyle<&Style::dimension, &Style::setDimension>( - node, Dimension::Width, StyleSizeLength::ofMaxContent()); -} - -void YGNodeStyleSetWidthFitContent(YGNodeRef node) { - updateStyle<&Style::dimension, &Style::setDimension>( - node, Dimension::Width, StyleSizeLength::ofFitContent()); -} - -void YGNodeStyleSetWidthStretch(YGNodeRef node) { - updateStyle<&Style::dimension, &Style::setDimension>( - node, Dimension::Width, StyleSizeLength::ofStretch()); -} - YGValue YGNodeStyleGetWidth(YGNodeConstRef node) { return (YGValue)resolveRef(node)->style().dimension(Dimension::Width); } @@ -370,21 +340,6 @@ void YGNodeStyleSetHeightAuto(YGNodeRef node) { node, Dimension::Height, StyleSizeLength::ofAuto()); } -void YGNodeStyleSetHeightMaxContent(YGNodeRef node) { - updateStyle<&Style::dimension, &Style::setDimension>( - node, Dimension::Height, StyleSizeLength::ofMaxContent()); -} - -void YGNodeStyleSetHeightFitContent(YGNodeRef node) { - updateStyle<&Style::dimension, &Style::setDimension>( - node, Dimension::Height, StyleSizeLength::ofFitContent()); -} - -void YGNodeStyleSetHeightStretch(YGNodeRef node) { - updateStyle<&Style::dimension, &Style::setDimension>( - node, Dimension::Height, StyleSizeLength::ofStretch()); -} - YGValue YGNodeStyleGetHeight(YGNodeConstRef node) { return (YGValue)resolveRef(node)->style().dimension(Dimension::Height); } @@ -399,21 +354,6 @@ void YGNodeStyleSetMinWidthPercent(const YGNodeRef node, const float minWidth) { node, Dimension::Width, StyleSizeLength::percent(minWidth)); } -void YGNodeStyleSetMinWidthMaxContent(const YGNodeRef node) { - updateStyle<&Style::minDimension, &Style::setMinDimension>( - node, Dimension::Width, StyleSizeLength::ofMaxContent()); -} - -void YGNodeStyleSetMinWidthFitContent(const YGNodeRef node) { - updateStyle<&Style::minDimension, &Style::setMinDimension>( - node, Dimension::Width, StyleSizeLength::ofFitContent()); -} - -void YGNodeStyleSetMinWidthStretch(const YGNodeRef node) { - updateStyle<&Style::minDimension, &Style::setMinDimension>( - node, Dimension::Width, StyleSizeLength::ofStretch()); -} - YGValue YGNodeStyleGetMinWidth(const YGNodeConstRef node) { return (YGValue)resolveRef(node)->style().minDimension(Dimension::Width); } @@ -430,21 +370,6 @@ void YGNodeStyleSetMinHeightPercent( node, Dimension::Height, StyleSizeLength::percent(minHeight)); } -void YGNodeStyleSetMinHeightMaxContent(const YGNodeRef node) { - updateStyle<&Style::minDimension, &Style::setMinDimension>( - node, Dimension::Height, StyleSizeLength::ofMaxContent()); -} - -void YGNodeStyleSetMinHeightFitContent(const YGNodeRef node) { - updateStyle<&Style::minDimension, &Style::setMinDimension>( - node, Dimension::Height, StyleSizeLength::ofFitContent()); -} - -void YGNodeStyleSetMinHeightStretch(const YGNodeRef node) { - updateStyle<&Style::minDimension, &Style::setMinDimension>( - node, Dimension::Height, StyleSizeLength::ofStretch()); -} - YGValue YGNodeStyleGetMinHeight(const YGNodeConstRef node) { return (YGValue)resolveRef(node)->style().minDimension(Dimension::Height); } @@ -459,21 +384,6 @@ void YGNodeStyleSetMaxWidthPercent(const YGNodeRef node, const float maxWidth) { node, Dimension::Width, StyleSizeLength::percent(maxWidth)); } -void YGNodeStyleSetMaxWidthMaxContent(const YGNodeRef node) { - updateStyle<&Style::maxDimension, &Style::setMaxDimension>( - node, Dimension::Width, StyleSizeLength::ofMaxContent()); -} - -void YGNodeStyleSetMaxWidthFitContent(const YGNodeRef node) { - updateStyle<&Style::maxDimension, &Style::setMaxDimension>( - node, Dimension::Width, StyleSizeLength::ofFitContent()); -} - -void YGNodeStyleSetMaxWidthStretch(const YGNodeRef node) { - updateStyle<&Style::maxDimension, &Style::setMaxDimension>( - node, Dimension::Width, StyleSizeLength::ofStretch()); -} - YGValue YGNodeStyleGetMaxWidth(const YGNodeConstRef node) { return (YGValue)resolveRef(node)->style().maxDimension(Dimension::Width); } @@ -490,21 +400,6 @@ void YGNodeStyleSetMaxHeightPercent( node, Dimension::Height, StyleSizeLength::percent(maxHeight)); } -void YGNodeStyleSetMaxHeightMaxContent(const YGNodeRef node) { - updateStyle<&Style::maxDimension, &Style::setMaxDimension>( - node, Dimension::Height, StyleSizeLength::ofMaxContent()); -} - -void YGNodeStyleSetMaxHeightFitContent(const YGNodeRef node) { - updateStyle<&Style::maxDimension, &Style::setMaxDimension>( - node, Dimension::Height, StyleSizeLength::ofFitContent()); -} - -void YGNodeStyleSetMaxHeightStretch(const YGNodeRef node) { - updateStyle<&Style::maxDimension, &Style::setMaxDimension>( - node, Dimension::Height, StyleSizeLength::ofStretch()); -} - YGValue YGNodeStyleGetMaxHeight(const YGNodeConstRef node) { return (YGValue)resolveRef(node)->style().maxDimension(Dimension::Height); } diff --git a/yoga/YGNodeStyle.h b/yoga/YGNodeStyle.h index a971138bb9..2746a4a00a 100644 --- a/yoga/YGNodeStyle.h +++ b/yoga/YGNodeStyle.h @@ -64,9 +64,6 @@ YG_EXPORT float YGNodeStyleGetFlexShrink(YGNodeConstRef node); YG_EXPORT void YGNodeStyleSetFlexBasis(YGNodeRef node, float flexBasis); YG_EXPORT void YGNodeStyleSetFlexBasisPercent(YGNodeRef node, float flexBasis); YG_EXPORT void YGNodeStyleSetFlexBasisAuto(YGNodeRef node); -YG_EXPORT void YGNodeStyleSetFlexBasisMaxContent(YGNodeRef node); -YG_EXPORT void YGNodeStyleSetFlexBasisFitContent(YGNodeRef node); -YG_EXPORT void YGNodeStyleSetFlexBasisStretch(YGNodeRef node); YG_EXPORT YGValue YGNodeStyleGetFlexBasis(YGNodeConstRef node); YG_EXPORT void @@ -104,45 +101,27 @@ YG_EXPORT YGBoxSizing YGNodeStyleGetBoxSizing(YGNodeConstRef node); YG_EXPORT void YGNodeStyleSetWidth(YGNodeRef node, float width); YG_EXPORT void YGNodeStyleSetWidthPercent(YGNodeRef node, float width); YG_EXPORT void YGNodeStyleSetWidthAuto(YGNodeRef node); -YG_EXPORT void YGNodeStyleSetWidthMaxContent(YGNodeRef node); -YG_EXPORT void YGNodeStyleSetWidthFitContent(YGNodeRef node); -YG_EXPORT void YGNodeStyleSetWidthStretch(YGNodeRef node); YG_EXPORT YGValue YGNodeStyleGetWidth(YGNodeConstRef node); YG_EXPORT void YGNodeStyleSetHeight(YGNodeRef node, float height); YG_EXPORT void YGNodeStyleSetHeightPercent(YGNodeRef node, float height); YG_EXPORT void YGNodeStyleSetHeightAuto(YGNodeRef node); -YG_EXPORT void YGNodeStyleSetHeightMaxContent(YGNodeRef node); -YG_EXPORT void YGNodeStyleSetHeightFitContent(YGNodeRef node); -YG_EXPORT void YGNodeStyleSetHeightStretch(YGNodeRef node); YG_EXPORT YGValue YGNodeStyleGetHeight(YGNodeConstRef node); YG_EXPORT void YGNodeStyleSetMinWidth(YGNodeRef node, float minWidth); YG_EXPORT void YGNodeStyleSetMinWidthPercent(YGNodeRef node, float minWidth); -YG_EXPORT void YGNodeStyleSetMinWidthMaxContent(YGNodeRef node); -YG_EXPORT void YGNodeStyleSetMinWidthFitContent(YGNodeRef node); -YG_EXPORT void YGNodeStyleSetMinWidthStretch(YGNodeRef node); YG_EXPORT YGValue YGNodeStyleGetMinWidth(YGNodeConstRef node); YG_EXPORT void YGNodeStyleSetMinHeight(YGNodeRef node, float minHeight); YG_EXPORT void YGNodeStyleSetMinHeightPercent(YGNodeRef node, float minHeight); -YG_EXPORT void YGNodeStyleSetMinHeightMaxContent(YGNodeRef node); -YG_EXPORT void YGNodeStyleSetMinHeightFitContent(YGNodeRef node); -YG_EXPORT void YGNodeStyleSetMinHeightStretch(YGNodeRef node); YG_EXPORT YGValue YGNodeStyleGetMinHeight(YGNodeConstRef node); YG_EXPORT void YGNodeStyleSetMaxWidth(YGNodeRef node, float maxWidth); YG_EXPORT void YGNodeStyleSetMaxWidthPercent(YGNodeRef node, float maxWidth); -YG_EXPORT void YGNodeStyleSetMaxWidthMaxContent(YGNodeRef node); -YG_EXPORT void YGNodeStyleSetMaxWidthFitContent(YGNodeRef node); -YG_EXPORT void YGNodeStyleSetMaxWidthStretch(YGNodeRef node); YG_EXPORT YGValue YGNodeStyleGetMaxWidth(YGNodeConstRef node); YG_EXPORT void YGNodeStyleSetMaxHeight(YGNodeRef node, float maxHeight); YG_EXPORT void YGNodeStyleSetMaxHeightPercent(YGNodeRef node, float maxHeight); -YG_EXPORT void YGNodeStyleSetMaxHeightMaxContent(YGNodeRef node); -YG_EXPORT void YGNodeStyleSetMaxHeightFitContent(YGNodeRef node); -YG_EXPORT void YGNodeStyleSetMaxHeightStretch(YGNodeRef node); YG_EXPORT YGValue YGNodeStyleGetMaxHeight(YGNodeConstRef node); YG_EXPORT void YGNodeStyleSetAspectRatio(YGNodeRef node, float aspectRatio);