From 42b6f6b6e59006ad06c6842d062a413779343fee Mon Sep 17 00:00:00 2001 From: Emil Sjolander Date: Fri, 2 Dec 2016 05:47:43 -0800 Subject: [PATCH] Rename enums Summary: new name, start by renaming enums Differential Revision: D4244360 fbshipit-source-id: c9fcbdd231098c9ff230a6055676bbc7cbd11001 --- CSSLayout/CSSEnums.h | 174 +-- CSSLayout/CSSLayout.c | 1249 ++++++++--------- CSSLayout/CSSLayout.h | 51 +- CSSLayout/CSSMacros.h | 8 +- CSSLayoutKit/Tests/CSSLayoutKitTests.m | 16 +- CSSLayoutKit/UIView+CSSLayout.h | 26 +- CSSLayoutKit/UIView+CSSLayout.m | 44 +- README.md | 2 +- benchmark/CSSBenchmark.c | 20 +- csharp/CSSLayout/CSSInterop.cpp | 2 +- csharp/CSSLayout/CSSInterop.h | 2 +- csharp/Facebook.CSSLayout/CSSDIrection.cs | 22 - csharp/Facebook.CSSLayout/CSSLogger.cs | 4 +- csharp/Facebook.CSSLayout/CSSMeasureFunc.cs | 6 +- csharp/Facebook.CSSLayout/CSSNode.Create.cs | 50 +- csharp/Facebook.CSSLayout/CSSNode.cs | 52 +- csharp/Facebook.CSSLayout/MeasureFunction.cs | 4 +- csharp/Facebook.CSSLayout/Native.cs | 62 +- .../{CSSAlign.cs => YogaAlign.cs} | 2 +- .../{CSSConstants.cs => YogaConstants.cs} | 2 +- .../{CSSDimension.cs => YogaDimension.cs} | 2 +- csharp/Facebook.CSSLayout/YogaDirection.cs | 18 + .../{CSSEdge.cs => YogaEdge.cs} | 2 +- ...lFeature.cs => YogaExperimentalFeature.cs} | 2 +- ...SFlexDirection.cs => YogaFlexDirection.cs} | 2 +- .../{CSSJustify.cs => YogaJustify.cs} | 2 +- .../{CSSLogLevel.cs => YogaLogLevel.cs} | 2 +- .../{CSSMeasureMode.cs => YogaMeasureMode.cs} | 2 +- .../{CSSOverflow.cs => YogaOverflow.cs} | 2 +- ...CSSPositionType.cs => YogaPositionType.cs} | 2 +- ...CSSPrintOptions.cs => YogaPrintOptions.cs} | 2 +- .../{CSSWrap.cs => YogaWrap.cs} | 2 +- .../CSSLayoutAbsolutePositionTest.cs | 102 +- .../CSSLayoutAlignContentTest.cs | 30 +- .../CSSLayoutAlignItemsTest.cs | 22 +- .../CSSLayoutAlignSelfTest.cs | 26 +- .../Facebook.CSSLayout/CSSLayoutBorderTest.cs | 62 +- .../CSSLayoutFlexDirectionTest.cs | 32 +- .../Facebook.CSSLayout/CSSLayoutFlexTest.cs | 32 +- .../CSSLayoutFlexWrapTest.cs | 34 +- .../CSSLayoutJustifyContentTest.cs | 66 +- .../Facebook.CSSLayout/CSSLayoutMarginTest.cs | 70 +- .../CSSLayoutMinMaxDimensionTest.cs | 50 +- .../CSSLayoutPaddingTest.cs | 78 +- .../CSSLayoutRoundingTest.cs | 94 +- .../Facebook.CSSLayout/CSSNodeCreateTest.cs | 100 +- .../tests/Facebook.CSSLayout/CSSNodeTest.cs | 2 +- enums.py | 48 +- gentest/gentest-cpp.js | 66 +- gentest/gentest-cs.js | 64 +- gentest/gentest-java.js | 64 +- gentest/gentest.js | 104 +- java/com/facebook/csslayout/CSSLogger.java | 4 +- java/com/facebook/csslayout/CSSNode.java | 102 +- java/com/facebook/csslayout/CSSNodeAPI.java | 56 +- .../{CSSAlign.java => YogaAlign.java} | 6 +- .../{CSSConstants.java => YogaConstants.java} | 2 +- .../{CSSDimension.java => YogaDimension.java} | 6 +- .../{CSSDirection.java => YogaDirection.java} | 6 +- .../csslayout/{CSSEdge.java => YogaEdge.java} | 6 +- ...ture.java => YogaExperimentalFeature.java} | 6 +- ...xDirection.java => YogaFlexDirection.java} | 6 +- .../{CSSJustify.java => YogaJustify.java} | 6 +- .../{CSSLogLevel.java => YogaLogLevel.java} | 6 +- ...SMeasureMode.java => YogaMeasureMode.java} | 6 +- .../{CSSOverflow.java => YogaOverflow.java} | 6 +- ...ositionType.java => YogaPositionType.java} | 6 +- ...rintOptions.java => YogaPrintOptions.java} | 6 +- .../csslayout/{CSSWrap.java => YogaWrap.java} | 6 +- java/jni/CSSJNI.cpp | 58 +- .../CSSLayoutAbsolutePositionTest.java | 102 +- .../csslayout/CSSLayoutAlignContentTest.java | 30 +- .../csslayout/CSSLayoutAlignItemsTest.java | 22 +- .../csslayout/CSSLayoutAlignSelfTest.java | 26 +- .../csslayout/CSSLayoutBorderTest.java | 62 +- .../csslayout/CSSLayoutFlexDirectionTest.java | 32 +- .../facebook/csslayout/CSSLayoutFlexTest.java | 32 +- .../csslayout/CSSLayoutFlexWrapTest.java | 34 +- .../CSSLayoutJustifyContentTest.java | 66 +- .../csslayout/CSSLayoutMarginTest.java | 70 +- .../CSSLayoutMinMaxDimensionTest.java | 50 +- .../csslayout/CSSLayoutPaddingTest.java | 78 +- .../csslayout/CSSLayoutRoundingTest.java | 94 +- .../com/facebook/csslayout/CSSNodeTest.java | 22 +- tests/CSSLayoutAbsolutePositionTest.cpp | 102 +- tests/CSSLayoutAlignContentTest.cpp | 30 +- tests/CSSLayoutAlignItemsTest.cpp | 22 +- tests/CSSLayoutAlignSelfTest.cpp | 26 +- tests/CSSLayoutAspectRatioTest.cpp | 84 +- tests/CSSLayoutBorderTest.cpp | 62 +- tests/CSSLayoutDefaultValuesTest.cpp | 68 +- tests/CSSLayoutDirtyMarkingTest.cpp | 14 +- tests/CSSLayoutEdgeTest.cpp | 70 +- tests/CSSLayoutFlexDirectionTest.cpp | 32 +- tests/CSSLayoutFlexTest.cpp | 32 +- tests/CSSLayoutFlexWrapTest.cpp | 34 +- tests/CSSLayoutJustifyContentTest.cpp | 66 +- tests/CSSLayoutMarginTest.cpp | 70 +- tests/CSSLayoutMeasureCacheTest.cpp | 46 +- tests/CSSLayoutMeasureModeTest.cpp | 78 +- tests/CSSLayoutMeasureTest.cpp | 6 +- tests/CSSLayoutMinMaxDimensionTest.cpp | 50 +- tests/CSSLayoutPaddingTest.cpp | 78 +- tests/CSSLayoutRelayoutTest.cpp | 8 +- tests/CSSLayoutRoundingMeasureFuncTest.cpp | 20 +- tests/CSSLayoutRoundingTest.cpp | 94 +- tests/CSSLayoutStyleTest.cpp | 12 +- 107 files changed, 2546 insertions(+), 2562 deletions(-) delete mode 100644 csharp/Facebook.CSSLayout/CSSDIrection.cs rename csharp/Facebook.CSSLayout/{CSSAlign.cs => YogaAlign.cs} (94%) rename csharp/Facebook.CSSLayout/{CSSConstants.cs => YogaConstants.cs} (93%) rename csharp/Facebook.CSSLayout/{CSSDimension.cs => YogaDimension.cs} (92%) create mode 100644 csharp/Facebook.CSSLayout/YogaDirection.cs rename csharp/Facebook.CSSLayout/{CSSEdge.cs => YogaEdge.cs} (95%) rename csharp/Facebook.CSSLayout/{CSSExperimentalFeature.cs => YogaExperimentalFeature.cs} (90%) rename csharp/Facebook.CSSLayout/{CSSFlexDirection.cs => YogaFlexDirection.cs} (92%) rename csharp/Facebook.CSSLayout/{CSSJustify.cs => YogaJustify.cs} (94%) rename csharp/Facebook.CSSLayout/{CSSLogLevel.cs => YogaLogLevel.cs} (93%) rename csharp/Facebook.CSSLayout/{CSSMeasureMode.cs => YogaMeasureMode.cs} (92%) rename csharp/Facebook.CSSLayout/{CSSOverflow.cs => YogaOverflow.cs} (93%) rename csharp/Facebook.CSSLayout/{CSSPositionType.cs => YogaPositionType.cs} (92%) rename csharp/Facebook.CSSLayout/{CSSPrintOptions.cs => YogaPrintOptions.cs} (92%) rename csharp/Facebook.CSSLayout/{CSSWrap.cs => YogaWrap.cs} (93%) rename java/com/facebook/csslayout/{CSSAlign.java => YogaAlign.java} (89%) rename java/com/facebook/csslayout/{CSSConstants.java => YogaConstants.java} (94%) rename java/com/facebook/csslayout/{CSSDimension.java => YogaDimension.java} (86%) rename java/com/facebook/csslayout/{CSSDirection.java => YogaDirection.java} (87%) rename java/com/facebook/csslayout/{CSSEdge.java => YogaEdge.java} (91%) rename java/com/facebook/csslayout/{CSSExperimentalFeature.java => YogaExperimentalFeature.java} (83%) rename java/com/facebook/csslayout/{CSSFlexDirection.java => YogaFlexDirection.java} (86%) rename java/com/facebook/csslayout/{CSSJustify.java => YogaJustify.java} (89%) rename java/com/facebook/csslayout/{CSSLogLevel.java => YogaLogLevel.java} (88%) rename java/com/facebook/csslayout/{CSSMeasureMode.java => YogaMeasureMode.java} (86%) rename java/com/facebook/csslayout/{CSSOverflow.java => YogaOverflow.java} (87%) rename java/com/facebook/csslayout/{CSSPositionType.java => YogaPositionType.java} (85%) rename java/com/facebook/csslayout/{CSSPrintOptions.java => YogaPrintOptions.java} (86%) rename java/com/facebook/csslayout/{CSSWrap.java => YogaWrap.java} (88%) diff --git a/CSSLayout/CSSEnums.h b/CSSLayout/CSSEnums.h index 94a6ba1b..2a87abf9 100644 --- a/CSSLayout/CSSEnums.h +++ b/CSSLayout/CSSEnums.h @@ -7,102 +7,102 @@ * of patent rights can be found in the PATENTS file in the same directory. */ -typedef enum CSSOverflow { - CSSOverflowVisible, - CSSOverflowHidden, - CSSOverflowScroll, - CSSOverflowCount, -} CSSOverflow; +typedef enum YGFlexDirection { + YGFlexDirectionColumn, + YGFlexDirectionColumnReverse, + YGFlexDirectionRow, + YGFlexDirectionRowReverse, + YGFlexDirectionCount, +} YGFlexDirection; -typedef enum CSSJustify { - CSSJustifyFlexStart, - CSSJustifyCenter, - CSSJustifyFlexEnd, - CSSJustifySpaceBetween, - CSSJustifySpaceAround, - CSSJustifyCount, -} CSSJustify; +typedef enum YGMeasureMode { + YGMeasureModeUndefined, + YGMeasureModeExactly, + YGMeasureModeAtMost, + YGMeasureModeCount, +} YGMeasureMode; -typedef enum CSSFlexDirection { - CSSFlexDirectionColumn, - CSSFlexDirectionColumnReverse, - CSSFlexDirectionRow, - CSSFlexDirectionRowReverse, - CSSFlexDirectionCount, -} CSSFlexDirection; +typedef enum YGPrintOptions { + YGPrintOptionsLayout = 1, + YGPrintOptionsStyle = 2, + YGPrintOptionsChildren = 4, + YGPrintOptionsCount, +} YGPrintOptions; -typedef enum CSSAlign { - CSSAlignAuto, - CSSAlignFlexStart, - CSSAlignCenter, - CSSAlignFlexEnd, - CSSAlignStretch, - CSSAlignCount, -} CSSAlign; +typedef enum YGEdge { + YGEdgeLeft, + YGEdgeTop, + YGEdgeRight, + YGEdgeBottom, + YGEdgeStart, + YGEdgeEnd, + YGEdgeHorizontal, + YGEdgeVertical, + YGEdgeAll, + YGEdgeCount, +} YGEdge; -typedef enum CSSEdge { - CSSEdgeLeft, - CSSEdgeTop, - CSSEdgeRight, - CSSEdgeBottom, - CSSEdgeStart, - CSSEdgeEnd, - CSSEdgeHorizontal, - CSSEdgeVertical, - CSSEdgeAll, - CSSEdgeCount, -} CSSEdge; +typedef enum YGPositionType { + YGPositionTypeRelative, + YGPositionTypeAbsolute, + YGPositionTypeCount, +} YGPositionType; -typedef enum CSSWrap { - CSSWrapNoWrap, - CSSWrapWrap, - CSSWrapCount, -} CSSWrap; +typedef enum YGDimension { + YGDimensionWidth, + YGDimensionHeight, + YGDimensionCount, +} YGDimension; -typedef enum CSSDirection { - CSSDirectionInherit, - CSSDirectionLTR, - CSSDirectionRTL, - CSSDirectionCount, -} CSSDirection; +typedef enum YGJustify { + YGJustifyFlexStart, + YGJustifyCenter, + YGJustifyFlexEnd, + YGJustifySpaceBetween, + YGJustifySpaceAround, + YGJustifyCount, +} YGJustify; -typedef enum CSSExperimentalFeature { - CSSExperimentalFeatureRounding, - CSSExperimentalFeatureWebFlexBasis, - CSSExperimentalFeatureCount, -} CSSExperimentalFeature; +typedef enum YGDirection { + YGDirectionInherit, + YGDirectionLTR, + YGDirectionRTL, + YGDirectionCount, +} YGDirection; -typedef enum CSSLogLevel { - CSSLogLevelError, - CSSLogLevelWarn, - CSSLogLevelInfo, - CSSLogLevelDebug, - CSSLogLevelVerbose, - CSSLogLevelCount, -} CSSLogLevel; +typedef enum YGLogLevel { + YGLogLevelError, + YGLogLevelWarn, + YGLogLevelInfo, + YGLogLevelDebug, + YGLogLevelVerbose, + YGLogLevelCount, +} YGLogLevel; -typedef enum CSSDimension { - CSSDimensionWidth, - CSSDimensionHeight, - CSSDimensionCount, -} CSSDimension; +typedef enum YGWrap { + YGWrapNoWrap, + YGWrapWrap, + YGWrapCount, +} YGWrap; -typedef enum CSSMeasureMode { - CSSMeasureModeUndefined, - CSSMeasureModeExactly, - CSSMeasureModeAtMost, - CSSMeasureModeCount, -} CSSMeasureMode; +typedef enum YGOverflow { + YGOverflowVisible, + YGOverflowHidden, + YGOverflowScroll, + YGOverflowCount, +} YGOverflow; -typedef enum CSSPositionType { - CSSPositionTypeRelative, - CSSPositionTypeAbsolute, - CSSPositionTypeCount, -} CSSPositionType; +typedef enum YGExperimentalFeature { + YGExperimentalFeatureRounding, + YGExperimentalFeatureWebFlexBasis, + YGExperimentalFeatureCount, +} YGExperimentalFeature; -typedef enum CSSPrintOptions { - CSSPrintOptionsLayout = 1, - CSSPrintOptionsStyle = 2, - CSSPrintOptionsChildren = 4, - CSSPrintOptionsCount, -} CSSPrintOptions; +typedef enum YGAlign { + YGAlignAuto, + YGAlignFlexStart, + YGAlignCenter, + YGAlignFlexEnd, + YGAlignStretch, + YGAlignCount, +} YGAlign; diff --git a/CSSLayout/CSSLayout.c b/CSSLayout/CSSLayout.c index 7067827a..c41194a1 100644 --- a/CSSLayout/CSSLayout.c +++ b/CSSLayout/CSSLayout.c @@ -33,8 +33,8 @@ __forceinline const float fmaxf(const float a, const float b) { typedef struct CSSCachedMeasurement { float availableWidth; float availableHeight; - CSSMeasureMode widthMeasureMode; - CSSMeasureMode heightMeasureMode; + YGMeasureMode widthMeasureMode; + YGMeasureMode heightMeasureMode; float computedWidth; float computedHeight; @@ -47,7 +47,7 @@ enum { CSS_MAX_CACHED_RESULT_COUNT = 16 }; typedef struct CSSLayout { float position[4]; float dimensions[2]; - CSSDirection direction; + YGDirection direction; uint32_t computedFlexBasisGeneration; float computedFlexBasis; @@ -55,7 +55,7 @@ typedef struct CSSLayout { // Instead of recomputing the entire layout every single time, we // cache some information to break early when nothing changed uint32_t generationCount; - CSSDirection lastParentDirection; + YGDirection lastParentDirection; uint32_t nextCachedMeasurementsIndex; CSSCachedMeasurement cachedMeasurements[CSS_MAX_CACHED_RESULT_COUNT]; @@ -65,23 +65,23 @@ typedef struct CSSLayout { } CSSLayout; typedef struct CSSStyle { - CSSDirection direction; - CSSFlexDirection flexDirection; - CSSJustify justifyContent; - CSSAlign alignContent; - CSSAlign alignItems; - CSSAlign alignSelf; - CSSPositionType positionType; - CSSWrap flexWrap; - CSSOverflow overflow; + YGDirection direction; + YGFlexDirection flexDirection; + YGJustify justifyContent; + YGAlign alignContent; + YGAlign alignItems; + YGAlign alignSelf; + YGPositionType positionType; + YGWrap flexWrap; + YGOverflow overflow; float flex; float flexGrow; float flexShrink; float flexBasis; - float margin[CSSEdgeCount]; - float position[CSSEdgeCount]; - float padding[CSSEdgeCount]; - float border[CSSEdgeCount]; + float margin[YGEdgeCount]; + float position[YGEdgeCount]; + float padding[YGEdgeCount]; + float border[YGEdgeCount]; float dimensions[2]; float minDimensions[2]; float maxDimensions[2]; @@ -115,25 +115,25 @@ CSSFree gCSSFree = &free; #ifdef ANDROID #include -static int _csslayoutAndroidLog(CSSLogLevel level, const char *format, va_list args) { - int androidLevel = CSSLogLevelDebug; +static int _csslayoutAndroidLog(YGLogLevel level, const char *format, va_list args) { + int androidLevel = YGLogLevelDebug; switch (level) { - case CSSLogLevelError: + case YGLogLevelError: androidLevel = ANDROID_LOG_ERROR; break; - case CSSLogLevelWarn: + case YGLogLevelWarn: androidLevel = ANDROID_LOG_WARN; break; - case CSSLogLevelInfo: + case YGLogLevelInfo: androidLevel = ANDROID_LOG_INFO; break; - case CSSLogLevelDebug: + case YGLogLevelDebug: androidLevel = ANDROID_LOG_DEBUG; break; - case CSSLogLevelVerbose: + case YGLogLevelVerbose: androidLevel = ANDROID_LOG_VERBOSE; break; - case CSSLogLevelCount: + case YGLogLevelCount: break; } const int result = __android_log_vprint(androidLevel, "css-layout", format, args); @@ -141,14 +141,14 @@ static int _csslayoutAndroidLog(CSSLogLevel level, const char *format, va_list a } static CSSLogger gLogger = &_csslayoutAndroidLog; #else -static int _csslayoutDefaultLog(CSSLogLevel level, const char *format, va_list args) { +static int _csslayoutDefaultLog(YGLogLevel level, const char *format, va_list args) { switch (level) { - case CSSLogLevelError: + case YGLogLevelError: return vfprintf(stderr, format, args); - case CSSLogLevelWarn: - case CSSLogLevelInfo: - case CSSLogLevelDebug: - case CSSLogLevelVerbose: + case YGLogLevelWarn: + case YGLogLevelInfo: + case YGLogLevelDebug: + case YGLogLevelVerbose: default: return vprintf(format, args); } @@ -156,31 +156,30 @@ static int _csslayoutDefaultLog(CSSLogLevel level, const char *format, va_list a static CSSLogger gLogger = &_csslayoutDefaultLog; #endif -static inline float computedEdgeValue(const float edges[CSSEdgeCount], - const CSSEdge edge, +static inline float computedEdgeValue(const float edges[YGEdgeCount], + const YGEdge edge, const float defaultValue) { - CSS_ASSERT(edge <= CSSEdgeEnd, "Cannot get computed value of multi-edge shorthands"); + CSS_ASSERT(edge <= YGEdgeEnd, "Cannot get computed value of multi-edge shorthands"); if (!CSSValueIsUndefined(edges[edge])) { return edges[edge]; } - if ((edge == CSSEdgeTop || edge == CSSEdgeBottom) && - !CSSValueIsUndefined(edges[CSSEdgeVertical])) { - return edges[CSSEdgeVertical]; + if ((edge == YGEdgeTop || edge == YGEdgeBottom) && !CSSValueIsUndefined(edges[YGEdgeVertical])) { + return edges[YGEdgeVertical]; } - if ((edge == CSSEdgeLeft || edge == CSSEdgeRight || edge == CSSEdgeStart || edge == CSSEdgeEnd) && - !CSSValueIsUndefined(edges[CSSEdgeHorizontal])) { - return edges[CSSEdgeHorizontal]; + if ((edge == YGEdgeLeft || edge == YGEdgeRight || edge == YGEdgeStart || edge == YGEdgeEnd) && + !CSSValueIsUndefined(edges[YGEdgeHorizontal])) { + return edges[YGEdgeHorizontal]; } - if (!CSSValueIsUndefined(edges[CSSEdgeAll])) { - return edges[CSSEdgeAll]; + if (!CSSValueIsUndefined(edges[YGEdgeAll])) { + return edges[YGEdgeAll]; } - if (edge == CSSEdgeStart || edge == CSSEdgeEnd) { - return CSSUndefined; + if (edge == YGEdgeStart || edge == YGEdgeEnd) { + return YGUndefined; } return defaultValue; @@ -242,50 +241,50 @@ void CSSNodeInit(const CSSNodeRef node) { node->hasNewLayout = true; node->isDirty = false; - node->style.flex = CSSUndefined; - node->style.flexGrow = CSSUndefined; - node->style.flexShrink = CSSUndefined; - node->style.flexBasis = CSSUndefined; + node->style.flex = YGUndefined; + node->style.flexGrow = YGUndefined; + node->style.flexShrink = YGUndefined; + node->style.flexBasis = YGUndefined; - node->style.alignItems = CSSAlignStretch; - node->style.alignContent = CSSAlignFlexStart; + node->style.alignItems = YGAlignStretch; + node->style.alignContent = YGAlignFlexStart; - node->style.direction = CSSDirectionInherit; - node->style.flexDirection = CSSFlexDirectionColumn; + node->style.direction = YGDirectionInherit; + node->style.flexDirection = YGFlexDirectionColumn; - node->style.overflow = CSSOverflowVisible; + node->style.overflow = YGOverflowVisible; // Some of the fields default to undefined and not 0 - node->style.dimensions[CSSDimensionWidth] = CSSUndefined; - node->style.dimensions[CSSDimensionHeight] = CSSUndefined; + node->style.dimensions[YGDimensionWidth] = YGUndefined; + node->style.dimensions[YGDimensionHeight] = YGUndefined; - node->style.minDimensions[CSSDimensionWidth] = CSSUndefined; - node->style.minDimensions[CSSDimensionHeight] = CSSUndefined; + node->style.minDimensions[YGDimensionWidth] = YGUndefined; + node->style.minDimensions[YGDimensionHeight] = YGUndefined; - node->style.maxDimensions[CSSDimensionWidth] = CSSUndefined; - node->style.maxDimensions[CSSDimensionHeight] = CSSUndefined; + node->style.maxDimensions[YGDimensionWidth] = YGUndefined; + node->style.maxDimensions[YGDimensionHeight] = YGUndefined; - for (CSSEdge edge = CSSEdgeLeft; edge < CSSEdgeCount; edge++) { - node->style.position[edge] = CSSUndefined; - node->style.margin[edge] = CSSUndefined; - node->style.padding[edge] = CSSUndefined; - node->style.border[edge] = CSSUndefined; + for (YGEdge edge = YGEdgeLeft; edge < YGEdgeCount; edge++) { + node->style.position[edge] = YGUndefined; + node->style.margin[edge] = YGUndefined; + node->style.padding[edge] = YGUndefined; + node->style.border[edge] = YGUndefined; } - node->style.aspectRatio = CSSUndefined; + node->style.aspectRatio = YGUndefined; - node->layout.dimensions[CSSDimensionWidth] = CSSUndefined; - node->layout.dimensions[CSSDimensionHeight] = CSSUndefined; + node->layout.dimensions[YGDimensionWidth] = YGUndefined; + node->layout.dimensions[YGDimensionHeight] = YGUndefined; // Such that the comparison is always going to be false - node->layout.lastParentDirection = (CSSDirection) -1; + node->layout.lastParentDirection = (YGDirection) -1; node->layout.nextCachedMeasurementsIndex = 0; - node->layout.computedFlexBasis = CSSUndefined; + node->layout.computedFlexBasis = YGUndefined; - node->layout.measuredDimensions[CSSDimensionWidth] = CSSUndefined; - node->layout.measuredDimensions[CSSDimensionHeight] = CSSUndefined; - node->layout.cachedLayout.widthMeasureMode = (CSSMeasureMode) -1; - node->layout.cachedLayout.heightMeasureMode = (CSSMeasureMode) -1; + node->layout.measuredDimensions[YGDimensionWidth] = YGUndefined; + node->layout.measuredDimensions[YGDimensionHeight] = YGUndefined; + node->layout.cachedLayout.widthMeasureMode = (YGMeasureMode) -1; + node->layout.cachedLayout.heightMeasureMode = (YGMeasureMode) -1; node->layout.cachedLayout.computedWidth = -1; node->layout.cachedLayout.computedHeight = -1; } @@ -293,7 +292,7 @@ void CSSNodeInit(const CSSNodeRef node) { static void _CSSNodeMarkDirty(const CSSNodeRef node) { if (!node->isDirty) { node->isDirty = true; - node->layout.computedFlexBasis = CSSUndefined; + node->layout.computedFlexBasis = YGUndefined; if (node->parent) { _CSSNodeMarkDirty(node->parent); } @@ -381,9 +380,9 @@ inline float CSSNodeStyleGetFlexBasis(const CSSNodeRef node) { return node->style.flexBasis; } if (!CSSValueIsUndefined(node->style.flex)) { - return node->style.flex > 0 ? 0 : CSSUndefined; + return node->style.flex > 0 ? 0 : YGUndefined; } - return CSSUndefined; + return YGUndefined; } void CSSNodeStyleSetFlex(const CSSNodeRef node, const float flex) { @@ -417,16 +416,16 @@ void CSSNodeStyleSetFlex(const CSSNodeRef node, const float flex) { return node->style.instanceName; \ } -#define CSS_NODE_STYLE_EDGE_PROPERTY_IMPL(type, name, paramName, instanceName, defaultValue) \ - void CSSNodeStyleSet##name(const CSSNodeRef node, const CSSEdge edge, const type paramName) { \ - if (node->style.instanceName[edge] != paramName) { \ - node->style.instanceName[edge] = paramName; \ - _CSSNodeMarkDirty(node); \ - } \ - } \ - \ - type CSSNodeStyleGet##name(const CSSNodeRef node, const CSSEdge edge) { \ - return computedEdgeValue(node->style.instanceName, edge, defaultValue); \ +#define CSS_NODE_STYLE_EDGE_PROPERTY_IMPL(type, name, paramName, instanceName, defaultValue) \ + void CSSNodeStyleSet##name(const CSSNodeRef node, const YGEdge edge, const type paramName) { \ + if (node->style.instanceName[edge] != paramName) { \ + node->style.instanceName[edge] = paramName; \ + _CSSNodeMarkDirty(node); \ + } \ + } \ + \ + type CSSNodeStyleGet##name(const CSSNodeRef node, const YGEdge edge) { \ + return computedEdgeValue(node->style.instanceName, edge, defaultValue); \ } #define CSS_NODE_LAYOUT_PROPERTY_IMPL(type, name, instanceName) \ @@ -438,51 +437,51 @@ CSS_NODE_PROPERTY_IMPL(void *, Context, context, context); CSS_NODE_PROPERTY_IMPL(CSSPrintFunc, PrintFunc, printFunc, print); CSS_NODE_PROPERTY_IMPL(bool, HasNewLayout, hasNewLayout, hasNewLayout); -CSS_NODE_STYLE_PROPERTY_IMPL(CSSDirection, Direction, direction, direction); -CSS_NODE_STYLE_PROPERTY_IMPL(CSSFlexDirection, FlexDirection, flexDirection, flexDirection); -CSS_NODE_STYLE_PROPERTY_IMPL(CSSJustify, JustifyContent, justifyContent, justifyContent); -CSS_NODE_STYLE_PROPERTY_IMPL(CSSAlign, AlignContent, alignContent, alignContent); -CSS_NODE_STYLE_PROPERTY_IMPL(CSSAlign, AlignItems, alignItems, alignItems); -CSS_NODE_STYLE_PROPERTY_IMPL(CSSAlign, AlignSelf, alignSelf, alignSelf); -CSS_NODE_STYLE_PROPERTY_IMPL(CSSPositionType, PositionType, positionType, positionType); -CSS_NODE_STYLE_PROPERTY_IMPL(CSSWrap, FlexWrap, flexWrap, flexWrap); -CSS_NODE_STYLE_PROPERTY_IMPL(CSSOverflow, Overflow, overflow, overflow); +CSS_NODE_STYLE_PROPERTY_IMPL(YGDirection, Direction, direction, direction); +CSS_NODE_STYLE_PROPERTY_IMPL(YGFlexDirection, FlexDirection, flexDirection, flexDirection); +CSS_NODE_STYLE_PROPERTY_IMPL(YGJustify, JustifyContent, justifyContent, justifyContent); +CSS_NODE_STYLE_PROPERTY_IMPL(YGAlign, AlignContent, alignContent, alignContent); +CSS_NODE_STYLE_PROPERTY_IMPL(YGAlign, AlignItems, alignItems, alignItems); +CSS_NODE_STYLE_PROPERTY_IMPL(YGAlign, AlignSelf, alignSelf, alignSelf); +CSS_NODE_STYLE_PROPERTY_IMPL(YGPositionType, PositionType, positionType, positionType); +CSS_NODE_STYLE_PROPERTY_IMPL(YGWrap, FlexWrap, flexWrap, flexWrap); +CSS_NODE_STYLE_PROPERTY_IMPL(YGOverflow, Overflow, overflow, overflow); CSS_NODE_STYLE_PROPERTY_SETTER_IMPL(float, FlexGrow, flexGrow, flexGrow); CSS_NODE_STYLE_PROPERTY_SETTER_IMPL(float, FlexShrink, flexShrink, flexShrink); CSS_NODE_STYLE_PROPERTY_SETTER_IMPL(float, FlexBasis, flexBasis, flexBasis); -CSS_NODE_STYLE_EDGE_PROPERTY_IMPL(float, Position, position, position, CSSUndefined); +CSS_NODE_STYLE_EDGE_PROPERTY_IMPL(float, Position, position, position, YGUndefined); CSS_NODE_STYLE_EDGE_PROPERTY_IMPL(float, Margin, margin, margin, 0); CSS_NODE_STYLE_EDGE_PROPERTY_IMPL(float, Padding, padding, padding, 0); CSS_NODE_STYLE_EDGE_PROPERTY_IMPL(float, Border, border, border, 0); -CSS_NODE_STYLE_PROPERTY_IMPL(float, Width, width, dimensions[CSSDimensionWidth]); -CSS_NODE_STYLE_PROPERTY_IMPL(float, Height, height, dimensions[CSSDimensionHeight]); -CSS_NODE_STYLE_PROPERTY_IMPL(float, MinWidth, minWidth, minDimensions[CSSDimensionWidth]); -CSS_NODE_STYLE_PROPERTY_IMPL(float, MinHeight, minHeight, minDimensions[CSSDimensionHeight]); -CSS_NODE_STYLE_PROPERTY_IMPL(float, MaxWidth, maxWidth, maxDimensions[CSSDimensionWidth]); -CSS_NODE_STYLE_PROPERTY_IMPL(float, MaxHeight, maxHeight, maxDimensions[CSSDimensionHeight]); +CSS_NODE_STYLE_PROPERTY_IMPL(float, Width, width, dimensions[YGDimensionWidth]); +CSS_NODE_STYLE_PROPERTY_IMPL(float, Height, height, dimensions[YGDimensionHeight]); +CSS_NODE_STYLE_PROPERTY_IMPL(float, MinWidth, minWidth, minDimensions[YGDimensionWidth]); +CSS_NODE_STYLE_PROPERTY_IMPL(float, MinHeight, minHeight, minDimensions[YGDimensionHeight]); +CSS_NODE_STYLE_PROPERTY_IMPL(float, MaxWidth, maxWidth, maxDimensions[YGDimensionWidth]); +CSS_NODE_STYLE_PROPERTY_IMPL(float, MaxHeight, maxHeight, maxDimensions[YGDimensionHeight]); // Yoga specific properties, not compatible with flexbox specification CSS_NODE_STYLE_PROPERTY_IMPL(float, AspectRatio, aspectRatio, aspectRatio); -CSS_NODE_LAYOUT_PROPERTY_IMPL(float, Left, position[CSSEdgeLeft]); -CSS_NODE_LAYOUT_PROPERTY_IMPL(float, Top, position[CSSEdgeTop]); -CSS_NODE_LAYOUT_PROPERTY_IMPL(float, Right, position[CSSEdgeRight]); -CSS_NODE_LAYOUT_PROPERTY_IMPL(float, Bottom, position[CSSEdgeBottom]); -CSS_NODE_LAYOUT_PROPERTY_IMPL(float, Width, dimensions[CSSDimensionWidth]); -CSS_NODE_LAYOUT_PROPERTY_IMPL(float, Height, dimensions[CSSDimensionHeight]); -CSS_NODE_LAYOUT_PROPERTY_IMPL(CSSDirection, Direction, direction); +CSS_NODE_LAYOUT_PROPERTY_IMPL(float, Left, position[YGEdgeLeft]); +CSS_NODE_LAYOUT_PROPERTY_IMPL(float, Top, position[YGEdgeTop]); +CSS_NODE_LAYOUT_PROPERTY_IMPL(float, Right, position[YGEdgeRight]); +CSS_NODE_LAYOUT_PROPERTY_IMPL(float, Bottom, position[YGEdgeBottom]); +CSS_NODE_LAYOUT_PROPERTY_IMPL(float, Width, dimensions[YGDimensionWidth]); +CSS_NODE_LAYOUT_PROPERTY_IMPL(float, Height, dimensions[YGDimensionHeight]); +CSS_NODE_LAYOUT_PROPERTY_IMPL(YGDirection, Direction, direction); uint32_t gCurrentGenerationCount = 0; bool layoutNodeInternal(const CSSNodeRef node, const float availableWidth, const float availableHeight, - const CSSDirection parentDirection, - const CSSMeasureMode widthMeasureMode, - const CSSMeasureMode heightMeasureMode, + const YGDirection parentDirection, + const YGMeasureMode widthMeasureMode, + const YGMeasureMode heightMeasureMode, const bool performLayout, const char *reason); @@ -499,19 +498,19 @@ static inline bool eq(const float a, const float b) { static void indent(const uint32_t n) { for (uint32_t i = 0; i < n; i++) { - CSSLog(CSSLogLevelDebug, " "); + CSSLog(YGLogLevelDebug, " "); } } static void printNumberIfNotZero(const char *str, const float number) { if (!eq(number, 0)) { - CSSLog(CSSLogLevelDebug, "%s: %g, ", str, number); + CSSLog(YGLogLevelDebug, "%s: %g, ", str, number); } } static void printNumberIfNotUndefined(const char *str, const float number) { if (!CSSValueIsUndefined(number)) { - CSSLog(CSSLogLevelDebug, "%s: %g, ", str, number); + CSSLog(YGLogLevelDebug, "%s: %g, ", str, number); } } @@ -520,370 +519,363 @@ static bool eqFour(const float four[4]) { } static void _CSSNodePrint(const CSSNodeRef node, - const CSSPrintOptions options, + const YGPrintOptions options, const uint32_t level) { indent(level); - CSSLog(CSSLogLevelDebug, "{"); + CSSLog(YGLogLevelDebug, "{"); if (node->print) { node->print(node); } - if (options & CSSPrintOptionsLayout) { - CSSLog(CSSLogLevelDebug, "layout: {"); - CSSLog(CSSLogLevelDebug, "width: %g, ", node->layout.dimensions[CSSDimensionWidth]); - CSSLog(CSSLogLevelDebug, "height: %g, ", node->layout.dimensions[CSSDimensionHeight]); - CSSLog(CSSLogLevelDebug, "top: %g, ", node->layout.position[CSSEdgeTop]); - CSSLog(CSSLogLevelDebug, "left: %g", node->layout.position[CSSEdgeLeft]); - CSSLog(CSSLogLevelDebug, "}, "); + if (options & YGPrintOptionsLayout) { + CSSLog(YGLogLevelDebug, "layout: {"); + CSSLog(YGLogLevelDebug, "width: %g, ", node->layout.dimensions[YGDimensionWidth]); + CSSLog(YGLogLevelDebug, "height: %g, ", node->layout.dimensions[YGDimensionHeight]); + CSSLog(YGLogLevelDebug, "top: %g, ", node->layout.position[YGEdgeTop]); + CSSLog(YGLogLevelDebug, "left: %g", node->layout.position[YGEdgeLeft]); + CSSLog(YGLogLevelDebug, "}, "); } - if (options & CSSPrintOptionsStyle) { - if (node->style.flexDirection == CSSFlexDirectionColumn) { - CSSLog(CSSLogLevelDebug, "flexDirection: 'column', "); - } else if (node->style.flexDirection == CSSFlexDirectionColumnReverse) { - CSSLog(CSSLogLevelDebug, "flexDirection: 'column-reverse', "); - } else if (node->style.flexDirection == CSSFlexDirectionRow) { - CSSLog(CSSLogLevelDebug, "flexDirection: 'row', "); - } else if (node->style.flexDirection == CSSFlexDirectionRowReverse) { - CSSLog(CSSLogLevelDebug, "flexDirection: 'row-reverse', "); + if (options & YGPrintOptionsStyle) { + if (node->style.flexDirection == YGFlexDirectionColumn) { + CSSLog(YGLogLevelDebug, "flexDirection: 'column', "); + } else if (node->style.flexDirection == YGFlexDirectionColumnReverse) { + CSSLog(YGLogLevelDebug, "flexDirection: 'column-reverse', "); + } else if (node->style.flexDirection == YGFlexDirectionRow) { + CSSLog(YGLogLevelDebug, "flexDirection: 'row', "); + } else if (node->style.flexDirection == YGFlexDirectionRowReverse) { + CSSLog(YGLogLevelDebug, "flexDirection: 'row-reverse', "); } - if (node->style.justifyContent == CSSJustifyCenter) { - CSSLog(CSSLogLevelDebug, "justifyContent: 'center', "); - } else if (node->style.justifyContent == CSSJustifyFlexEnd) { - CSSLog(CSSLogLevelDebug, "justifyContent: 'flex-end', "); - } else if (node->style.justifyContent == CSSJustifySpaceAround) { - CSSLog(CSSLogLevelDebug, "justifyContent: 'space-around', "); - } else if (node->style.justifyContent == CSSJustifySpaceBetween) { - CSSLog(CSSLogLevelDebug, "justifyContent: 'space-between', "); + if (node->style.justifyContent == YGJustifyCenter) { + CSSLog(YGLogLevelDebug, "justifyContent: 'center', "); + } else if (node->style.justifyContent == YGJustifyFlexEnd) { + CSSLog(YGLogLevelDebug, "justifyContent: 'flex-end', "); + } else if (node->style.justifyContent == YGJustifySpaceAround) { + CSSLog(YGLogLevelDebug, "justifyContent: 'space-around', "); + } else if (node->style.justifyContent == YGJustifySpaceBetween) { + CSSLog(YGLogLevelDebug, "justifyContent: 'space-between', "); } - if (node->style.alignItems == CSSAlignCenter) { - CSSLog(CSSLogLevelDebug, "alignItems: 'center', "); - } else if (node->style.alignItems == CSSAlignFlexEnd) { - CSSLog(CSSLogLevelDebug, "alignItems: 'flex-end', "); - } else if (node->style.alignItems == CSSAlignStretch) { - CSSLog(CSSLogLevelDebug, "alignItems: 'stretch', "); + if (node->style.alignItems == YGAlignCenter) { + CSSLog(YGLogLevelDebug, "alignItems: 'center', "); + } else if (node->style.alignItems == YGAlignFlexEnd) { + CSSLog(YGLogLevelDebug, "alignItems: 'flex-end', "); + } else if (node->style.alignItems == YGAlignStretch) { + CSSLog(YGLogLevelDebug, "alignItems: 'stretch', "); } - if (node->style.alignContent == CSSAlignCenter) { - CSSLog(CSSLogLevelDebug, "alignContent: 'center', "); - } else if (node->style.alignContent == CSSAlignFlexEnd) { - CSSLog(CSSLogLevelDebug, "alignContent: 'flex-end', "); - } else if (node->style.alignContent == CSSAlignStretch) { - CSSLog(CSSLogLevelDebug, "alignContent: 'stretch', "); + if (node->style.alignContent == YGAlignCenter) { + CSSLog(YGLogLevelDebug, "alignContent: 'center', "); + } else if (node->style.alignContent == YGAlignFlexEnd) { + CSSLog(YGLogLevelDebug, "alignContent: 'flex-end', "); + } else if (node->style.alignContent == YGAlignStretch) { + CSSLog(YGLogLevelDebug, "alignContent: 'stretch', "); } - if (node->style.alignSelf == CSSAlignFlexStart) { - CSSLog(CSSLogLevelDebug, "alignSelf: 'flex-start', "); - } else if (node->style.alignSelf == CSSAlignCenter) { - CSSLog(CSSLogLevelDebug, "alignSelf: 'center', "); - } else if (node->style.alignSelf == CSSAlignFlexEnd) { - CSSLog(CSSLogLevelDebug, "alignSelf: 'flex-end', "); - } else if (node->style.alignSelf == CSSAlignStretch) { - CSSLog(CSSLogLevelDebug, "alignSelf: 'stretch', "); + if (node->style.alignSelf == YGAlignFlexStart) { + CSSLog(YGLogLevelDebug, "alignSelf: 'flex-start', "); + } else if (node->style.alignSelf == YGAlignCenter) { + CSSLog(YGLogLevelDebug, "alignSelf: 'center', "); + } else if (node->style.alignSelf == YGAlignFlexEnd) { + CSSLog(YGLogLevelDebug, "alignSelf: 'flex-end', "); + } else if (node->style.alignSelf == YGAlignStretch) { + CSSLog(YGLogLevelDebug, "alignSelf: 'stretch', "); } printNumberIfNotUndefined("flexGrow", CSSNodeStyleGetFlexGrow(node)); printNumberIfNotUndefined("flexShrink", CSSNodeStyleGetFlexShrink(node)); printNumberIfNotUndefined("flexBasis", CSSNodeStyleGetFlexBasis(node)); - if (node->style.overflow == CSSOverflowHidden) { - CSSLog(CSSLogLevelDebug, "overflow: 'hidden', "); - } else if (node->style.overflow == CSSOverflowVisible) { - CSSLog(CSSLogLevelDebug, "overflow: 'visible', "); - } else if (node->style.overflow == CSSOverflowScroll) { - CSSLog(CSSLogLevelDebug, "overflow: 'scroll', "); + if (node->style.overflow == YGOverflowHidden) { + CSSLog(YGLogLevelDebug, "overflow: 'hidden', "); + } else if (node->style.overflow == YGOverflowVisible) { + CSSLog(YGLogLevelDebug, "overflow: 'visible', "); + } else if (node->style.overflow == YGOverflowScroll) { + CSSLog(YGLogLevelDebug, "overflow: 'scroll', "); } if (eqFour(node->style.margin)) { - printNumberIfNotZero("margin", computedEdgeValue(node->style.margin, CSSEdgeLeft, 0)); + printNumberIfNotZero("margin", computedEdgeValue(node->style.margin, YGEdgeLeft, 0)); } else { - printNumberIfNotZero("marginLeft", computedEdgeValue(node->style.margin, CSSEdgeLeft, 0)); - printNumberIfNotZero("marginRight", computedEdgeValue(node->style.margin, CSSEdgeRight, 0)); - printNumberIfNotZero("marginTop", computedEdgeValue(node->style.margin, CSSEdgeTop, 0)); - printNumberIfNotZero("marginBottom", computedEdgeValue(node->style.margin, CSSEdgeBottom, 0)); - printNumberIfNotZero("marginStart", computedEdgeValue(node->style.margin, CSSEdgeStart, 0)); - printNumberIfNotZero("marginEnd", computedEdgeValue(node->style.margin, CSSEdgeEnd, 0)); + printNumberIfNotZero("marginLeft", computedEdgeValue(node->style.margin, YGEdgeLeft, 0)); + printNumberIfNotZero("marginRight", computedEdgeValue(node->style.margin, YGEdgeRight, 0)); + printNumberIfNotZero("marginTop", computedEdgeValue(node->style.margin, YGEdgeTop, 0)); + printNumberIfNotZero("marginBottom", computedEdgeValue(node->style.margin, YGEdgeBottom, 0)); + printNumberIfNotZero("marginStart", computedEdgeValue(node->style.margin, YGEdgeStart, 0)); + printNumberIfNotZero("marginEnd", computedEdgeValue(node->style.margin, YGEdgeEnd, 0)); } if (eqFour(node->style.padding)) { - printNumberIfNotZero("padding", computedEdgeValue(node->style.padding, CSSEdgeLeft, 0)); + printNumberIfNotZero("padding", computedEdgeValue(node->style.padding, YGEdgeLeft, 0)); } else { - printNumberIfNotZero("paddingLeft", computedEdgeValue(node->style.padding, CSSEdgeLeft, 0)); - printNumberIfNotZero("paddingRight", computedEdgeValue(node->style.padding, CSSEdgeRight, 0)); - printNumberIfNotZero("paddingTop", computedEdgeValue(node->style.padding, CSSEdgeTop, 0)); + printNumberIfNotZero("paddingLeft", computedEdgeValue(node->style.padding, YGEdgeLeft, 0)); + printNumberIfNotZero("paddingRight", computedEdgeValue(node->style.padding, YGEdgeRight, 0)); + printNumberIfNotZero("paddingTop", computedEdgeValue(node->style.padding, YGEdgeTop, 0)); printNumberIfNotZero("paddingBottom", - computedEdgeValue(node->style.padding, CSSEdgeBottom, 0)); - printNumberIfNotZero("paddingStart", computedEdgeValue(node->style.padding, CSSEdgeStart, 0)); - printNumberIfNotZero("paddingEnd", computedEdgeValue(node->style.padding, CSSEdgeEnd, 0)); + computedEdgeValue(node->style.padding, YGEdgeBottom, 0)); + printNumberIfNotZero("paddingStart", computedEdgeValue(node->style.padding, YGEdgeStart, 0)); + printNumberIfNotZero("paddingEnd", computedEdgeValue(node->style.padding, YGEdgeEnd, 0)); } if (eqFour(node->style.border)) { - printNumberIfNotZero("borderWidth", computedEdgeValue(node->style.border, CSSEdgeLeft, 0)); + printNumberIfNotZero("borderWidth", computedEdgeValue(node->style.border, YGEdgeLeft, 0)); } else { - printNumberIfNotZero("borderLeftWidth", - computedEdgeValue(node->style.border, CSSEdgeLeft, 0)); + printNumberIfNotZero("borderLeftWidth", computedEdgeValue(node->style.border, YGEdgeLeft, 0)); printNumberIfNotZero("borderRightWidth", - computedEdgeValue(node->style.border, CSSEdgeRight, 0)); - printNumberIfNotZero("borderTopWidth", computedEdgeValue(node->style.border, CSSEdgeTop, 0)); + computedEdgeValue(node->style.border, YGEdgeRight, 0)); + printNumberIfNotZero("borderTopWidth", computedEdgeValue(node->style.border, YGEdgeTop, 0)); printNumberIfNotZero("borderBottomWidth", - computedEdgeValue(node->style.border, CSSEdgeBottom, 0)); + computedEdgeValue(node->style.border, YGEdgeBottom, 0)); printNumberIfNotZero("borderStartWidth", - computedEdgeValue(node->style.border, CSSEdgeStart, 0)); - printNumberIfNotZero("borderEndWidth", computedEdgeValue(node->style.border, CSSEdgeEnd, 0)); + computedEdgeValue(node->style.border, YGEdgeStart, 0)); + printNumberIfNotZero("borderEndWidth", computedEdgeValue(node->style.border, YGEdgeEnd, 0)); } - printNumberIfNotUndefined("width", node->style.dimensions[CSSDimensionWidth]); - printNumberIfNotUndefined("height", node->style.dimensions[CSSDimensionHeight]); - printNumberIfNotUndefined("maxWidth", node->style.maxDimensions[CSSDimensionWidth]); - printNumberIfNotUndefined("maxHeight", node->style.maxDimensions[CSSDimensionHeight]); - printNumberIfNotUndefined("minWidth", node->style.minDimensions[CSSDimensionWidth]); - printNumberIfNotUndefined("minHeight", node->style.minDimensions[CSSDimensionHeight]); + printNumberIfNotUndefined("width", node->style.dimensions[YGDimensionWidth]); + printNumberIfNotUndefined("height", node->style.dimensions[YGDimensionHeight]); + printNumberIfNotUndefined("maxWidth", node->style.maxDimensions[YGDimensionWidth]); + printNumberIfNotUndefined("maxHeight", node->style.maxDimensions[YGDimensionHeight]); + printNumberIfNotUndefined("minWidth", node->style.minDimensions[YGDimensionWidth]); + printNumberIfNotUndefined("minHeight", node->style.minDimensions[YGDimensionHeight]); - if (node->style.positionType == CSSPositionTypeAbsolute) { - CSSLog(CSSLogLevelDebug, "position: 'absolute', "); + if (node->style.positionType == YGPositionTypeAbsolute) { + CSSLog(YGLogLevelDebug, "position: 'absolute', "); } printNumberIfNotUndefined("left", - computedEdgeValue(node->style.position, CSSEdgeLeft, CSSUndefined)); + computedEdgeValue(node->style.position, YGEdgeLeft, YGUndefined)); printNumberIfNotUndefined("right", - computedEdgeValue(node->style.position, CSSEdgeRight, CSSUndefined)); + computedEdgeValue(node->style.position, YGEdgeRight, YGUndefined)); printNumberIfNotUndefined("top", - computedEdgeValue(node->style.position, CSSEdgeTop, CSSUndefined)); + computedEdgeValue(node->style.position, YGEdgeTop, YGUndefined)); printNumberIfNotUndefined("bottom", - computedEdgeValue(node->style.position, CSSEdgeBottom, CSSUndefined)); + computedEdgeValue(node->style.position, YGEdgeBottom, YGUndefined)); } const uint32_t childCount = CSSNodeListCount(node->children); - if (options & CSSPrintOptionsChildren && childCount > 0) { - CSSLog(CSSLogLevelDebug, "children: [\n"); + if (options & YGPrintOptionsChildren && childCount > 0) { + CSSLog(YGLogLevelDebug, "children: [\n"); for (uint32_t i = 0; i < childCount; i++) { _CSSNodePrint(CSSNodeGetChild(node, i), options, level + 1); } indent(level); - CSSLog(CSSLogLevelDebug, "]},\n"); + CSSLog(YGLogLevelDebug, "]},\n"); } else { - CSSLog(CSSLogLevelDebug, "},\n"); + CSSLog(YGLogLevelDebug, "},\n"); } } -void CSSNodePrint(const CSSNodeRef node, const CSSPrintOptions options) { +void CSSNodePrint(const CSSNodeRef node, const YGPrintOptions options) { _CSSNodePrint(node, options, 0); } -static const CSSEdge leading[4] = { - [CSSFlexDirectionColumn] = CSSEdgeTop, - [CSSFlexDirectionColumnReverse] = CSSEdgeBottom, - [CSSFlexDirectionRow] = CSSEdgeLeft, - [CSSFlexDirectionRowReverse] = CSSEdgeRight, +static const YGEdge leading[4] = { + [YGFlexDirectionColumn] = YGEdgeTop, + [YGFlexDirectionColumnReverse] = YGEdgeBottom, + [YGFlexDirectionRow] = YGEdgeLeft, + [YGFlexDirectionRowReverse] = YGEdgeRight, }; -static const CSSEdge trailing[4] = { - [CSSFlexDirectionColumn] = CSSEdgeBottom, - [CSSFlexDirectionColumnReverse] = CSSEdgeTop, - [CSSFlexDirectionRow] = CSSEdgeRight, - [CSSFlexDirectionRowReverse] = CSSEdgeLeft, +static const YGEdge trailing[4] = { + [YGFlexDirectionColumn] = YGEdgeBottom, + [YGFlexDirectionColumnReverse] = YGEdgeTop, + [YGFlexDirectionRow] = YGEdgeRight, + [YGFlexDirectionRowReverse] = YGEdgeLeft, }; -static const CSSEdge pos[4] = { - [CSSFlexDirectionColumn] = CSSEdgeTop, - [CSSFlexDirectionColumnReverse] = CSSEdgeBottom, - [CSSFlexDirectionRow] = CSSEdgeLeft, - [CSSFlexDirectionRowReverse] = CSSEdgeRight, +static const YGEdge pos[4] = { + [YGFlexDirectionColumn] = YGEdgeTop, + [YGFlexDirectionColumnReverse] = YGEdgeBottom, + [YGFlexDirectionRow] = YGEdgeLeft, + [YGFlexDirectionRowReverse] = YGEdgeRight, }; -static const CSSDimension dim[4] = { - [CSSFlexDirectionColumn] = CSSDimensionHeight, - [CSSFlexDirectionColumnReverse] = CSSDimensionHeight, - [CSSFlexDirectionRow] = CSSDimensionWidth, - [CSSFlexDirectionRowReverse] = CSSDimensionWidth, +static const YGDimension dim[4] = { + [YGFlexDirectionColumn] = YGDimensionHeight, + [YGFlexDirectionColumnReverse] = YGDimensionHeight, + [YGFlexDirectionRow] = YGDimensionWidth, + [YGFlexDirectionRowReverse] = YGDimensionWidth, }; -static inline bool isRowDirection(const CSSFlexDirection flexDirection) { - return flexDirection == CSSFlexDirectionRow || flexDirection == CSSFlexDirectionRowReverse; +static inline bool isRowDirection(const YGFlexDirection flexDirection) { + return flexDirection == YGFlexDirectionRow || flexDirection == YGFlexDirectionRowReverse; } -static inline bool isColumnDirection(const CSSFlexDirection flexDirection) { - return flexDirection == CSSFlexDirectionColumn || flexDirection == CSSFlexDirectionColumnReverse; +static inline bool isColumnDirection(const YGFlexDirection flexDirection) { + return flexDirection == YGFlexDirectionColumn || flexDirection == YGFlexDirectionColumnReverse; } -static inline float getLeadingMargin(const CSSNodeRef node, const CSSFlexDirection axis) { - if (isRowDirection(axis) && !CSSValueIsUndefined(node->style.margin[CSSEdgeStart])) { - return node->style.margin[CSSEdgeStart]; +static inline float getLeadingMargin(const CSSNodeRef node, const YGFlexDirection axis) { + if (isRowDirection(axis) && !CSSValueIsUndefined(node->style.margin[YGEdgeStart])) { + return node->style.margin[YGEdgeStart]; } return computedEdgeValue(node->style.margin, leading[axis], 0); } -static float getTrailingMargin(const CSSNodeRef node, const CSSFlexDirection axis) { - if (isRowDirection(axis) && !CSSValueIsUndefined(node->style.margin[CSSEdgeEnd])) { - return node->style.margin[CSSEdgeEnd]; +static float getTrailingMargin(const CSSNodeRef node, const YGFlexDirection axis) { + if (isRowDirection(axis) && !CSSValueIsUndefined(node->style.margin[YGEdgeEnd])) { + return node->style.margin[YGEdgeEnd]; } return computedEdgeValue(node->style.margin, trailing[axis], 0); } -static float getLeadingPadding(const CSSNodeRef node, const CSSFlexDirection axis) { - if (isRowDirection(axis) && !CSSValueIsUndefined(node->style.padding[CSSEdgeStart]) && - node->style.padding[CSSEdgeStart] >= 0) { - return node->style.padding[CSSEdgeStart]; +static float getLeadingPadding(const CSSNodeRef node, const YGFlexDirection axis) { + if (isRowDirection(axis) && !CSSValueIsUndefined(node->style.padding[YGEdgeStart]) && + node->style.padding[YGEdgeStart] >= 0) { + return node->style.padding[YGEdgeStart]; } return fmaxf(computedEdgeValue(node->style.padding, leading[axis], 0), 0); } -static float getTrailingPadding(const CSSNodeRef node, const CSSFlexDirection axis) { - if (isRowDirection(axis) && !CSSValueIsUndefined(node->style.padding[CSSEdgeEnd]) && - node->style.padding[CSSEdgeEnd] >= 0) { - return node->style.padding[CSSEdgeEnd]; +static float getTrailingPadding(const CSSNodeRef node, const YGFlexDirection axis) { + if (isRowDirection(axis) && !CSSValueIsUndefined(node->style.padding[YGEdgeEnd]) && + node->style.padding[YGEdgeEnd] >= 0) { + return node->style.padding[YGEdgeEnd]; } return fmaxf(computedEdgeValue(node->style.padding, trailing[axis], 0), 0); } -static float getLeadingBorder(const CSSNodeRef node, const CSSFlexDirection axis) { - if (isRowDirection(axis) && !CSSValueIsUndefined(node->style.border[CSSEdgeStart]) && - node->style.border[CSSEdgeStart] >= 0) { - return node->style.border[CSSEdgeStart]; +static float getLeadingBorder(const CSSNodeRef node, const YGFlexDirection axis) { + if (isRowDirection(axis) && !CSSValueIsUndefined(node->style.border[YGEdgeStart]) && + node->style.border[YGEdgeStart] >= 0) { + return node->style.border[YGEdgeStart]; } return fmaxf(computedEdgeValue(node->style.border, leading[axis], 0), 0); } -static float getTrailingBorder(const CSSNodeRef node, const CSSFlexDirection axis) { - if (isRowDirection(axis) && !CSSValueIsUndefined(node->style.border[CSSEdgeEnd]) && - node->style.border[CSSEdgeEnd] >= 0) { - return node->style.border[CSSEdgeEnd]; +static float getTrailingBorder(const CSSNodeRef node, const YGFlexDirection axis) { + if (isRowDirection(axis) && !CSSValueIsUndefined(node->style.border[YGEdgeEnd]) && + node->style.border[YGEdgeEnd] >= 0) { + return node->style.border[YGEdgeEnd]; } return fmaxf(computedEdgeValue(node->style.border, trailing[axis], 0), 0); } -static inline float getLeadingPaddingAndBorder(const CSSNodeRef node, const CSSFlexDirection axis) { +static inline float getLeadingPaddingAndBorder(const CSSNodeRef node, const YGFlexDirection axis) { return getLeadingPadding(node, axis) + getLeadingBorder(node, axis); } -static inline float getTrailingPaddingAndBorder(const CSSNodeRef node, - const CSSFlexDirection axis) { +static inline float getTrailingPaddingAndBorder(const CSSNodeRef node, const YGFlexDirection axis) { return getTrailingPadding(node, axis) + getTrailingBorder(node, axis); } -static inline float getMarginAxis(const CSSNodeRef node, const CSSFlexDirection axis) { +static inline float getMarginAxis(const CSSNodeRef node, const YGFlexDirection axis) { return getLeadingMargin(node, axis) + getTrailingMargin(node, axis); } -static inline float getPaddingAndBorderAxis(const CSSNodeRef node, const CSSFlexDirection axis) { +static inline float getPaddingAndBorderAxis(const CSSNodeRef node, const YGFlexDirection axis) { return getLeadingPaddingAndBorder(node, axis) + getTrailingPaddingAndBorder(node, axis); } -static inline CSSAlign getAlignItem(const CSSNodeRef node, const CSSNodeRef child) { - return child->style.alignSelf == CSSAlignAuto ? node->style.alignItems : child->style.alignSelf; +static inline YGAlign getAlignItem(const CSSNodeRef node, const CSSNodeRef child) { + return child->style.alignSelf == YGAlignAuto ? node->style.alignItems : child->style.alignSelf; } -static inline CSSDirection resolveDirection(const CSSNodeRef node, - const CSSDirection parentDirection) { - if (node->style.direction == CSSDirectionInherit) { - return parentDirection > CSSDirectionInherit ? parentDirection : CSSDirectionLTR; +static inline YGDirection resolveDirection(const CSSNodeRef node, + const YGDirection parentDirection) { + if (node->style.direction == YGDirectionInherit) { + return parentDirection > YGDirectionInherit ? parentDirection : YGDirectionLTR; } else { return node->style.direction; } } -static inline CSSFlexDirection resolveAxis(const CSSFlexDirection flexDirection, - const CSSDirection direction) { - if (direction == CSSDirectionRTL) { - if (flexDirection == CSSFlexDirectionRow) { - return CSSFlexDirectionRowReverse; - } else if (flexDirection == CSSFlexDirectionRowReverse) { - return CSSFlexDirectionRow; +static inline YGFlexDirection resolveAxis(const YGFlexDirection flexDirection, + const YGDirection direction) { + if (direction == YGDirectionRTL) { + if (flexDirection == YGFlexDirectionRow) { + return YGFlexDirectionRowReverse; + } else if (flexDirection == YGFlexDirectionRowReverse) { + return YGFlexDirectionRow; } } return flexDirection; } -static CSSFlexDirection getCrossFlexDirection(const CSSFlexDirection flexDirection, - const CSSDirection direction) { - return isColumnDirection(flexDirection) ? resolveAxis(CSSFlexDirectionRow, direction) - : CSSFlexDirectionColumn; +static YGFlexDirection getCrossFlexDirection(const YGFlexDirection flexDirection, + const YGDirection direction) { + return isColumnDirection(flexDirection) ? resolveAxis(YGFlexDirectionRow, direction) + : YGFlexDirectionColumn; } static inline bool isFlex(const CSSNodeRef node) { - return (node->style.positionType == CSSPositionTypeRelative && + return (node->style.positionType == YGPositionTypeRelative && (node->style.flexGrow != 0 || node->style.flexShrink != 0 || node->style.flex != 0)); } -static inline float getDimWithMargin(const CSSNodeRef node, const CSSFlexDirection axis) { +static inline float getDimWithMargin(const CSSNodeRef node, const YGFlexDirection axis) { return node->layout.measuredDimensions[dim[axis]] + getLeadingMargin(node, axis) + getTrailingMargin(node, axis); } -static inline bool isStyleDimDefined(const CSSNodeRef node, const CSSFlexDirection axis) { +static inline bool isStyleDimDefined(const CSSNodeRef node, const YGFlexDirection axis) { const float value = node->style.dimensions[dim[axis]]; return !CSSValueIsUndefined(value) && value >= 0.0; } -static inline bool isLayoutDimDefined(const CSSNodeRef node, const CSSFlexDirection axis) { +static inline bool isLayoutDimDefined(const CSSNodeRef node, const YGFlexDirection axis) { const float value = node->layout.measuredDimensions[dim[axis]]; return !CSSValueIsUndefined(value) && value >= 0.0; } -static inline bool isLeadingPosDefined(const CSSNodeRef node, const CSSFlexDirection axis) { +static inline bool isLeadingPosDefined(const CSSNodeRef node, const YGFlexDirection axis) { return (isRowDirection(axis) && !CSSValueIsUndefined( - computedEdgeValue(node->style.position, CSSEdgeStart, CSSUndefined))) || - !CSSValueIsUndefined(computedEdgeValue(node->style.position, leading[axis], CSSUndefined)); + computedEdgeValue(node->style.position, YGEdgeStart, YGUndefined))) || + !CSSValueIsUndefined(computedEdgeValue(node->style.position, leading[axis], YGUndefined)); } -static inline bool isTrailingPosDefined(const CSSNodeRef node, const CSSFlexDirection axis) { +static inline bool isTrailingPosDefined(const CSSNodeRef node, const YGFlexDirection axis) { return (isRowDirection(axis) && - !CSSValueIsUndefined( - computedEdgeValue(node->style.position, CSSEdgeEnd, CSSUndefined))) || - !CSSValueIsUndefined( - computedEdgeValue(node->style.position, trailing[axis], CSSUndefined)); + !CSSValueIsUndefined(computedEdgeValue(node->style.position, YGEdgeEnd, YGUndefined))) || + !CSSValueIsUndefined(computedEdgeValue(node->style.position, trailing[axis], YGUndefined)); } -static float getLeadingPosition(const CSSNodeRef node, const CSSFlexDirection axis) { +static float getLeadingPosition(const CSSNodeRef node, const YGFlexDirection axis) { if (isRowDirection(axis)) { - const float leadingPosition = - computedEdgeValue(node->style.position, CSSEdgeStart, CSSUndefined); + const float leadingPosition = computedEdgeValue(node->style.position, YGEdgeStart, YGUndefined); if (!CSSValueIsUndefined(leadingPosition)) { return leadingPosition; } } - const float leadingPosition = - computedEdgeValue(node->style.position, leading[axis], CSSUndefined); + const float leadingPosition = computedEdgeValue(node->style.position, leading[axis], YGUndefined); return CSSValueIsUndefined(leadingPosition) ? 0 : leadingPosition; } -static float getTrailingPosition(const CSSNodeRef node, const CSSFlexDirection axis) { +static float getTrailingPosition(const CSSNodeRef node, const YGFlexDirection axis) { if (isRowDirection(axis)) { - const float trailingPosition = - computedEdgeValue(node->style.position, CSSEdgeEnd, CSSUndefined); + const float trailingPosition = computedEdgeValue(node->style.position, YGEdgeEnd, YGUndefined); if (!CSSValueIsUndefined(trailingPosition)) { return trailingPosition; } } const float trailingPosition = - computedEdgeValue(node->style.position, trailing[axis], CSSUndefined); + computedEdgeValue(node->style.position, trailing[axis], YGUndefined); return CSSValueIsUndefined(trailingPosition) ? 0 : trailingPosition; } static float boundAxisWithinMinAndMax(const CSSNodeRef node, - const CSSFlexDirection axis, + const YGFlexDirection axis, const float value) { - float min = CSSUndefined; - float max = CSSUndefined; + float min = YGUndefined; + float max = YGUndefined; if (isColumnDirection(axis)) { - min = node->style.minDimensions[CSSDimensionHeight]; - max = node->style.maxDimensions[CSSDimensionHeight]; + min = node->style.minDimensions[YGDimensionHeight]; + max = node->style.maxDimensions[YGDimensionHeight]; } else if (isRowDirection(axis)) { - min = node->style.minDimensions[CSSDimensionWidth]; - max = node->style.maxDimensions[CSSDimensionWidth]; + min = node->style.minDimensions[YGDimensionWidth]; + max = node->style.maxDimensions[YGDimensionWidth]; } float boundValue = value; @@ -903,14 +895,14 @@ static float boundAxisWithinMinAndMax(const CSSNodeRef node, // below the // padding and border amount. static inline float boundAxis(const CSSNodeRef node, - const CSSFlexDirection axis, + const YGFlexDirection axis, const float value) { return fmaxf(boundAxisWithinMinAndMax(node, axis, value), getPaddingAndBorderAxis(node, axis)); } static void setTrailingPosition(const CSSNodeRef node, const CSSNodeRef child, - const CSSFlexDirection axis) { + const YGFlexDirection axis) { const float size = child->layout.measuredDimensions[dim[axis]]; child->layout.position[trailing[axis]] = node->layout.measuredDimensions[dim[axis]] - size - child->layout.position[pos[axis]]; @@ -918,31 +910,31 @@ static void setTrailingPosition(const CSSNodeRef node, // If both left and right are defined, then use left. Otherwise return // +left or -right depending on which is defined. -static float getRelativePosition(const CSSNodeRef node, const CSSFlexDirection axis) { +static float getRelativePosition(const CSSNodeRef node, const YGFlexDirection axis) { return isLeadingPosDefined(node, axis) ? getLeadingPosition(node, axis) : -getTrailingPosition(node, axis); } -static void constrainMaxSizeForMode(const float maxSize, CSSMeasureMode *mode, float *size) { +static void constrainMaxSizeForMode(const float maxSize, YGMeasureMode *mode, float *size) { switch (*mode) { - case CSSMeasureModeExactly: - case CSSMeasureModeAtMost: + case YGMeasureModeExactly: + case YGMeasureModeAtMost: *size = (CSSValueIsUndefined(maxSize) || *size < maxSize) ? *size : maxSize; break; - case CSSMeasureModeUndefined: + case YGMeasureModeUndefined: if (!CSSValueIsUndefined(maxSize)) { - *mode = CSSMeasureModeAtMost; + *mode = YGMeasureModeAtMost; *size = maxSize; } break; - case CSSMeasureModeCount: + case YGMeasureModeCount: break; } } -static void setPosition(const CSSNodeRef node, const CSSDirection direction) { - const CSSFlexDirection mainAxis = resolveAxis(node->style.flexDirection, direction); - const CSSFlexDirection crossAxis = getCrossFlexDirection(mainAxis, direction); +static void setPosition(const CSSNodeRef node, const YGDirection direction) { + const YGFlexDirection mainAxis = resolveAxis(node->style.flexDirection, direction); + const YGFlexDirection crossAxis = getCrossFlexDirection(mainAxis, direction); const float relativePositionMain = getRelativePosition(node, mainAxis); const float relativePositionCross = getRelativePosition(node, crossAxis); @@ -959,71 +951,71 @@ static void setPosition(const CSSNodeRef node, const CSSDirection direction) { static void computeChildFlexBasis(const CSSNodeRef node, const CSSNodeRef child, const float width, - const CSSMeasureMode widthMode, + const YGMeasureMode widthMode, const float height, - const CSSMeasureMode heightMode, - const CSSDirection direction) { - const CSSFlexDirection mainAxis = resolveAxis(node->style.flexDirection, direction); + const YGMeasureMode heightMode, + const YGDirection direction) { + const YGFlexDirection mainAxis = resolveAxis(node->style.flexDirection, direction); const bool isMainAxisRow = isRowDirection(mainAxis); float childWidth; float childHeight; - CSSMeasureMode childWidthMeasureMode; - CSSMeasureMode childHeightMeasureMode; + YGMeasureMode childWidthMeasureMode; + YGMeasureMode childHeightMeasureMode; - const bool isRowStyleDimDefined = isStyleDimDefined(child, CSSFlexDirectionRow); - const bool isColumnStyleDimDefined = isStyleDimDefined(child, CSSFlexDirectionColumn); + const bool isRowStyleDimDefined = isStyleDimDefined(child, YGFlexDirectionRow); + const bool isColumnStyleDimDefined = isStyleDimDefined(child, YGFlexDirectionColumn); if (!CSSValueIsUndefined(CSSNodeStyleGetFlexBasis(child)) && !CSSValueIsUndefined(isMainAxisRow ? width : height)) { if (CSSValueIsUndefined(child->layout.computedFlexBasis) || - (CSSLayoutIsExperimentalFeatureEnabled(CSSExperimentalFeatureWebFlexBasis) && + (CSSLayoutIsExperimentalFeatureEnabled(YGExperimentalFeatureWebFlexBasis) && child->layout.computedFlexBasisGeneration != gCurrentGenerationCount)) { child->layout.computedFlexBasis = fmaxf(CSSNodeStyleGetFlexBasis(child), getPaddingAndBorderAxis(child, mainAxis)); } } else if (isMainAxisRow && isRowStyleDimDefined) { // The width is definite, so use that as the flex basis. - child->layout.computedFlexBasis = fmaxf(child->style.dimensions[CSSDimensionWidth], - getPaddingAndBorderAxis(child, CSSFlexDirectionRow)); + child->layout.computedFlexBasis = fmaxf(child->style.dimensions[YGDimensionWidth], + getPaddingAndBorderAxis(child, YGFlexDirectionRow)); } else if (!isMainAxisRow && isColumnStyleDimDefined) { // The height is definite, so use that as the flex basis. - child->layout.computedFlexBasis = fmaxf(child->style.dimensions[CSSDimensionHeight], - getPaddingAndBorderAxis(child, CSSFlexDirectionColumn)); + child->layout.computedFlexBasis = fmaxf(child->style.dimensions[YGDimensionHeight], + getPaddingAndBorderAxis(child, YGFlexDirectionColumn)); } else { // Compute the flex basis and hypothetical main size (i.e. the clamped // flex basis). - childWidth = CSSUndefined; - childHeight = CSSUndefined; - childWidthMeasureMode = CSSMeasureModeUndefined; - childHeightMeasureMode = CSSMeasureModeUndefined; + childWidth = YGUndefined; + childHeight = YGUndefined; + childWidthMeasureMode = YGMeasureModeUndefined; + childHeightMeasureMode = YGMeasureModeUndefined; if (isRowStyleDimDefined) { childWidth = - child->style.dimensions[CSSDimensionWidth] + getMarginAxis(child, CSSFlexDirectionRow); - childWidthMeasureMode = CSSMeasureModeExactly; + child->style.dimensions[YGDimensionWidth] + getMarginAxis(child, YGFlexDirectionRow); + childWidthMeasureMode = YGMeasureModeExactly; } if (isColumnStyleDimDefined) { - childHeight = child->style.dimensions[CSSDimensionHeight] + - getMarginAxis(child, CSSFlexDirectionColumn); - childHeightMeasureMode = CSSMeasureModeExactly; + childHeight = + child->style.dimensions[YGDimensionHeight] + getMarginAxis(child, YGFlexDirectionColumn); + childHeightMeasureMode = YGMeasureModeExactly; } // The W3C spec doesn't say anything about the 'overflow' property, // but all major browsers appear to implement the following logic. - if ((!isMainAxisRow && node->style.overflow == CSSOverflowScroll) || - node->style.overflow != CSSOverflowScroll) { + if ((!isMainAxisRow && node->style.overflow == YGOverflowScroll) || + node->style.overflow != YGOverflowScroll) { if (CSSValueIsUndefined(childWidth) && !CSSValueIsUndefined(width)) { childWidth = width; - childWidthMeasureMode = CSSMeasureModeAtMost; + childWidthMeasureMode = YGMeasureModeAtMost; } } - if ((isMainAxisRow && node->style.overflow == CSSOverflowScroll) || - node->style.overflow != CSSOverflowScroll) { + if ((isMainAxisRow && node->style.overflow == YGOverflowScroll) || + node->style.overflow != YGOverflowScroll) { if (CSSValueIsUndefined(childHeight) && !CSSValueIsUndefined(height)) { childHeight = height; - childHeightMeasureMode = CSSMeasureModeAtMost; + childHeightMeasureMode = YGMeasureModeAtMost; } } @@ -1031,34 +1023,33 @@ static void computeChildFlexBasis(const CSSNodeRef node, // set the cross // axis to be measured exactly with the available inner width if (!isMainAxisRow && !CSSValueIsUndefined(width) && !isRowStyleDimDefined && - widthMode == CSSMeasureModeExactly && getAlignItem(node, child) == CSSAlignStretch) { + widthMode == YGMeasureModeExactly && getAlignItem(node, child) == YGAlignStretch) { childWidth = width; - childWidthMeasureMode = CSSMeasureModeExactly; + childWidthMeasureMode = YGMeasureModeExactly; } if (isMainAxisRow && !CSSValueIsUndefined(height) && !isColumnStyleDimDefined && - heightMode == CSSMeasureModeExactly && getAlignItem(node, child) == CSSAlignStretch) { + heightMode == YGMeasureModeExactly && getAlignItem(node, child) == YGAlignStretch) { childHeight = height; - childHeightMeasureMode = CSSMeasureModeExactly; + childHeightMeasureMode = YGMeasureModeExactly; } if (!CSSValueIsUndefined(child->style.aspectRatio)) { - if (!isMainAxisRow && childWidthMeasureMode == CSSMeasureModeExactly) { + if (!isMainAxisRow && childWidthMeasureMode == YGMeasureModeExactly) { child->layout.computedFlexBasis = fmaxf(childWidth * child->style.aspectRatio, - getPaddingAndBorderAxis(child, CSSFlexDirectionColumn)); + getPaddingAndBorderAxis(child, YGFlexDirectionColumn)); return; - } else if (isMainAxisRow && childHeightMeasureMode == CSSMeasureModeExactly) { - child->layout.computedFlexBasis = - fmaxf(childHeight * child->style.aspectRatio, - getPaddingAndBorderAxis(child, CSSFlexDirectionRow)); + } else if (isMainAxisRow && childHeightMeasureMode == YGMeasureModeExactly) { + child->layout.computedFlexBasis = fmaxf(childHeight * child->style.aspectRatio, + getPaddingAndBorderAxis(child, YGFlexDirectionRow)); return; } } - constrainMaxSizeForMode(child->style.maxDimensions[CSSDimensionWidth], + constrainMaxSizeForMode(child->style.maxDimensions[YGDimensionWidth], &childWidthMeasureMode, &childWidth); - constrainMaxSizeForMode(child->style.maxDimensions[CSSDimensionHeight], + constrainMaxSizeForMode(child->style.maxDimensions[YGDimensionHeight], &childHeightMeasureMode, &childHeight); @@ -1073,8 +1064,8 @@ static void computeChildFlexBasis(const CSSNodeRef node, "measure"); child->layout.computedFlexBasis = - fmaxf(isMainAxisRow ? child->layout.measuredDimensions[CSSDimensionWidth] - : child->layout.measuredDimensions[CSSDimensionHeight], + fmaxf(isMainAxisRow ? child->layout.measuredDimensions[YGDimensionWidth] + : child->layout.measuredDimensions[YGDimensionHeight], getPaddingAndBorderAxis(child, mainAxis)); } @@ -1084,50 +1075,50 @@ static void computeChildFlexBasis(const CSSNodeRef node, static void absoluteLayoutChild(const CSSNodeRef node, const CSSNodeRef child, const float width, - const CSSMeasureMode widthMode, - const CSSDirection direction) { - const CSSFlexDirection mainAxis = resolveAxis(node->style.flexDirection, direction); - const CSSFlexDirection crossAxis = getCrossFlexDirection(mainAxis, direction); + const YGMeasureMode widthMode, + const YGDirection direction) { + const YGFlexDirection mainAxis = resolveAxis(node->style.flexDirection, direction); + const YGFlexDirection crossAxis = getCrossFlexDirection(mainAxis, direction); const bool isMainAxisRow = isRowDirection(mainAxis); - float childWidth = CSSUndefined; - float childHeight = CSSUndefined; - CSSMeasureMode childWidthMeasureMode = CSSMeasureModeUndefined; - CSSMeasureMode childHeightMeasureMode = CSSMeasureModeUndefined; + float childWidth = YGUndefined; + float childHeight = YGUndefined; + YGMeasureMode childWidthMeasureMode = YGMeasureModeUndefined; + YGMeasureMode childHeightMeasureMode = YGMeasureModeUndefined; - if (isStyleDimDefined(child, CSSFlexDirectionRow)) { + if (isStyleDimDefined(child, YGFlexDirectionRow)) { childWidth = - child->style.dimensions[CSSDimensionWidth] + getMarginAxis(child, CSSFlexDirectionRow); + child->style.dimensions[YGDimensionWidth] + getMarginAxis(child, YGFlexDirectionRow); } else { // If the child doesn't have a specified width, compute the width based // on the left/right // offsets if they're defined. - if (isLeadingPosDefined(child, CSSFlexDirectionRow) && - isTrailingPosDefined(child, CSSFlexDirectionRow)) { - childWidth = node->layout.measuredDimensions[CSSDimensionWidth] - - (getLeadingBorder(node, CSSFlexDirectionRow) + - getTrailingBorder(node, CSSFlexDirectionRow)) - - (getLeadingPosition(child, CSSFlexDirectionRow) + - getTrailingPosition(child, CSSFlexDirectionRow)); - childWidth = boundAxis(child, CSSFlexDirectionRow, childWidth); + if (isLeadingPosDefined(child, YGFlexDirectionRow) && + isTrailingPosDefined(child, YGFlexDirectionRow)) { + childWidth = node->layout.measuredDimensions[YGDimensionWidth] - + (getLeadingBorder(node, YGFlexDirectionRow) + + getTrailingBorder(node, YGFlexDirectionRow)) - + (getLeadingPosition(child, YGFlexDirectionRow) + + getTrailingPosition(child, YGFlexDirectionRow)); + childWidth = boundAxis(child, YGFlexDirectionRow, childWidth); } } - if (isStyleDimDefined(child, CSSFlexDirectionColumn)) { + if (isStyleDimDefined(child, YGFlexDirectionColumn)) { childHeight = - child->style.dimensions[CSSDimensionHeight] + getMarginAxis(child, CSSFlexDirectionColumn); + child->style.dimensions[YGDimensionHeight] + getMarginAxis(child, YGFlexDirectionColumn); } else { // If the child doesn't have a specified height, compute the height // based on the top/bottom // offsets if they're defined. - if (isLeadingPosDefined(child, CSSFlexDirectionColumn) && - isTrailingPosDefined(child, CSSFlexDirectionColumn)) { - childHeight = node->layout.measuredDimensions[CSSDimensionHeight] - - (getLeadingBorder(node, CSSFlexDirectionColumn) + - getTrailingBorder(node, CSSFlexDirectionColumn)) - - (getLeadingPosition(child, CSSFlexDirectionColumn) + - getTrailingPosition(child, CSSFlexDirectionColumn)); - childHeight = boundAxis(child, CSSFlexDirectionColumn, childHeight); + if (isLeadingPosDefined(child, YGFlexDirectionColumn) && + isTrailingPosDefined(child, YGFlexDirectionColumn)) { + childHeight = node->layout.measuredDimensions[YGDimensionHeight] - + (getLeadingBorder(node, YGFlexDirectionColumn) + + getTrailingBorder(node, YGFlexDirectionColumn)) - + (getLeadingPosition(child, YGFlexDirectionColumn) + + getTrailingPosition(child, YGFlexDirectionColumn)); + childHeight = boundAxis(child, YGFlexDirectionColumn, childHeight); } } @@ -1137,10 +1128,10 @@ static void absoluteLayoutChild(const CSSNodeRef node, if (!CSSValueIsUndefined(child->style.aspectRatio)) { if (CSSValueIsUndefined(childWidth)) { childWidth = fmaxf(childHeight * child->style.aspectRatio, - getPaddingAndBorderAxis(child, CSSFlexDirectionColumn)); + getPaddingAndBorderAxis(child, YGFlexDirectionColumn)); } else if (CSSValueIsUndefined(childHeight)) { childHeight = fmaxf(childWidth * child->style.aspectRatio, - getPaddingAndBorderAxis(child, CSSFlexDirectionRow)); + getPaddingAndBorderAxis(child, YGFlexDirectionRow)); } } } @@ -1148,17 +1139,17 @@ static void absoluteLayoutChild(const CSSNodeRef node, // If we're still missing one or the other dimension, measure the content. if (CSSValueIsUndefined(childWidth) || CSSValueIsUndefined(childHeight)) { childWidthMeasureMode = - CSSValueIsUndefined(childWidth) ? CSSMeasureModeUndefined : CSSMeasureModeExactly; + CSSValueIsUndefined(childWidth) ? YGMeasureModeUndefined : YGMeasureModeExactly; childHeightMeasureMode = - CSSValueIsUndefined(childHeight) ? CSSMeasureModeUndefined : CSSMeasureModeExactly; + CSSValueIsUndefined(childHeight) ? YGMeasureModeUndefined : YGMeasureModeExactly; // According to the spec, if the main size is not definite and the // child's inline axis is parallel to the main axis (i.e. it's // horizontal), the child should be sized using "UNDEFINED" in // the main size. Otherwise use "AT_MOST" in the cross axis. - if (!isMainAxisRow && CSSValueIsUndefined(childWidth) && widthMode != CSSMeasureModeUndefined) { + if (!isMainAxisRow && CSSValueIsUndefined(childWidth) && widthMode != YGMeasureModeUndefined) { childWidth = width; - childWidthMeasureMode = CSSMeasureModeAtMost; + childWidthMeasureMode = YGMeasureModeAtMost; } layoutNodeInternal(child, @@ -1169,18 +1160,18 @@ static void absoluteLayoutChild(const CSSNodeRef node, childHeightMeasureMode, false, "abs-measure"); - childWidth = child->layout.measuredDimensions[CSSDimensionWidth] + - getMarginAxis(child, CSSFlexDirectionRow); - childHeight = child->layout.measuredDimensions[CSSDimensionHeight] + - getMarginAxis(child, CSSFlexDirectionColumn); + childWidth = child->layout.measuredDimensions[YGDimensionWidth] + + getMarginAxis(child, YGFlexDirectionRow); + childHeight = child->layout.measuredDimensions[YGDimensionHeight] + + getMarginAxis(child, YGFlexDirectionColumn); } layoutNodeInternal(child, childWidth, childHeight, direction, - CSSMeasureModeExactly, - CSSMeasureModeExactly, + YGMeasureModeExactly, + YGMeasureModeExactly, true, "abs-layout"); @@ -1202,47 +1193,46 @@ static void absoluteLayoutChild(const CSSNodeRef node, static void setMeasuredDimensionsForNodeWithMeasureFunc(const CSSNodeRef node, const float availableWidth, const float availableHeight, - const CSSMeasureMode widthMeasureMode, - const CSSMeasureMode heightMeasureMode) { + const YGMeasureMode widthMeasureMode, + const YGMeasureMode heightMeasureMode) { CSS_ASSERT(node->measure, "Expected node to have custom measure function"); - const float paddingAndBorderAxisRow = getPaddingAndBorderAxis(node, CSSFlexDirectionRow); - const float paddingAndBorderAxisColumn = getPaddingAndBorderAxis(node, CSSFlexDirectionColumn); - const float marginAxisRow = getMarginAxis(node, CSSFlexDirectionRow); - const float marginAxisColumn = getMarginAxis(node, CSSFlexDirectionColumn); + const float paddingAndBorderAxisRow = getPaddingAndBorderAxis(node, YGFlexDirectionRow); + const float paddingAndBorderAxisColumn = getPaddingAndBorderAxis(node, YGFlexDirectionColumn); + const float marginAxisRow = getMarginAxis(node, YGFlexDirectionRow); + const float marginAxisColumn = getMarginAxis(node, YGFlexDirectionColumn); const float innerWidth = availableWidth - marginAxisRow - paddingAndBorderAxisRow; const float innerHeight = availableHeight - marginAxisColumn - paddingAndBorderAxisColumn; - if (widthMeasureMode == CSSMeasureModeExactly && heightMeasureMode == CSSMeasureModeExactly) { + if (widthMeasureMode == YGMeasureModeExactly && heightMeasureMode == YGMeasureModeExactly) { // Don't bother sizing the text if both dimensions are already defined. - node->layout.measuredDimensions[CSSDimensionWidth] = - boundAxis(node, CSSFlexDirectionRow, availableWidth - marginAxisRow); - node->layout.measuredDimensions[CSSDimensionHeight] = - boundAxis(node, CSSFlexDirectionColumn, availableHeight - marginAxisColumn); + node->layout.measuredDimensions[YGDimensionWidth] = + boundAxis(node, YGFlexDirectionRow, availableWidth - marginAxisRow); + node->layout.measuredDimensions[YGDimensionHeight] = + boundAxis(node, YGFlexDirectionColumn, availableHeight - marginAxisColumn); } else if (innerWidth <= 0 || innerHeight <= 0) { // Don't bother sizing the text if there's no horizontal or vertical // space. - node->layout.measuredDimensions[CSSDimensionWidth] = boundAxis(node, CSSFlexDirectionRow, 0); - node->layout.measuredDimensions[CSSDimensionHeight] = - boundAxis(node, CSSFlexDirectionColumn, 0); + node->layout.measuredDimensions[YGDimensionWidth] = boundAxis(node, YGFlexDirectionRow, 0); + node->layout.measuredDimensions[YGDimensionHeight] = boundAxis(node, YGFlexDirectionColumn, 0); } else { // Measure the text under the current constraints. const CSSSize measuredSize = node->measure(node, innerWidth, widthMeasureMode, innerHeight, heightMeasureMode); - node->layout.measuredDimensions[CSSDimensionWidth] = + node->layout.measuredDimensions[YGDimensionWidth] = boundAxis(node, - CSSFlexDirectionRow, - (widthMeasureMode == CSSMeasureModeUndefined || - widthMeasureMode == CSSMeasureModeAtMost) + YGFlexDirectionRow, + (widthMeasureMode == YGMeasureModeUndefined || + widthMeasureMode == YGMeasureModeAtMost) ? measuredSize.width + paddingAndBorderAxisRow : availableWidth - marginAxisRow); - node->layout.measuredDimensions[CSSDimensionHeight] = + node->layout.measuredDimensions[YGDimensionHeight] = boundAxis(node, - CSSFlexDirectionColumn, - (heightMeasureMode == CSSMeasureModeUndefined || - heightMeasureMode == CSSMeasureModeAtMost) + YGFlexDirectionColumn, + (heightMeasureMode == YGMeasureModeUndefined || + heightMeasureMode == YGMeasureModeAtMost) ? measuredSize.height + paddingAndBorderAxisColumn : availableHeight - marginAxisColumn); } @@ -1253,25 +1243,25 @@ static void setMeasuredDimensionsForNodeWithMeasureFunc(const CSSNodeRef node, static void setMeasuredDimensionsForEmptyContainer(const CSSNodeRef node, const float availableWidth, const float availableHeight, - const CSSMeasureMode widthMeasureMode, - const CSSMeasureMode heightMeasureMode) { - const float paddingAndBorderAxisRow = getPaddingAndBorderAxis(node, CSSFlexDirectionRow); - const float paddingAndBorderAxisColumn = getPaddingAndBorderAxis(node, CSSFlexDirectionColumn); - const float marginAxisRow = getMarginAxis(node, CSSFlexDirectionRow); - const float marginAxisColumn = getMarginAxis(node, CSSFlexDirectionColumn); + const YGMeasureMode widthMeasureMode, + const YGMeasureMode heightMeasureMode) { + const float paddingAndBorderAxisRow = getPaddingAndBorderAxis(node, YGFlexDirectionRow); + const float paddingAndBorderAxisColumn = getPaddingAndBorderAxis(node, YGFlexDirectionColumn); + const float marginAxisRow = getMarginAxis(node, YGFlexDirectionRow); + const float marginAxisColumn = getMarginAxis(node, YGFlexDirectionColumn); - node->layout.measuredDimensions[CSSDimensionWidth] = + node->layout.measuredDimensions[YGDimensionWidth] = boundAxis(node, - CSSFlexDirectionRow, - (widthMeasureMode == CSSMeasureModeUndefined || - widthMeasureMode == CSSMeasureModeAtMost) + YGFlexDirectionRow, + (widthMeasureMode == YGMeasureModeUndefined || + widthMeasureMode == YGMeasureModeAtMost) ? paddingAndBorderAxisRow : availableWidth - marginAxisRow); - node->layout.measuredDimensions[CSSDimensionHeight] = + node->layout.measuredDimensions[YGDimensionHeight] = boundAxis(node, - CSSFlexDirectionColumn, - (heightMeasureMode == CSSMeasureModeUndefined || - heightMeasureMode == CSSMeasureModeAtMost) + YGFlexDirectionColumn, + (heightMeasureMode == YGMeasureModeUndefined || + heightMeasureMode == YGMeasureModeAtMost) ? paddingAndBorderAxisColumn : availableHeight - marginAxisColumn); } @@ -1279,25 +1269,25 @@ static void setMeasuredDimensionsForEmptyContainer(const CSSNodeRef node, static bool setMeasuredDimensionsIfEmptyOrFixedSize(const CSSNodeRef node, const float availableWidth, const float availableHeight, - const CSSMeasureMode widthMeasureMode, - const CSSMeasureMode heightMeasureMode) { - if ((widthMeasureMode == CSSMeasureModeAtMost && availableWidth <= 0) || - (heightMeasureMode == CSSMeasureModeAtMost && availableHeight <= 0) || - (widthMeasureMode == CSSMeasureModeExactly && heightMeasureMode == CSSMeasureModeExactly)) { - const float marginAxisColumn = getMarginAxis(node, CSSFlexDirectionColumn); - const float marginAxisRow = getMarginAxis(node, CSSFlexDirectionRow); + const YGMeasureMode widthMeasureMode, + const YGMeasureMode heightMeasureMode) { + if ((widthMeasureMode == YGMeasureModeAtMost && availableWidth <= 0) || + (heightMeasureMode == YGMeasureModeAtMost && availableHeight <= 0) || + (widthMeasureMode == YGMeasureModeExactly && heightMeasureMode == YGMeasureModeExactly)) { + const float marginAxisColumn = getMarginAxis(node, YGFlexDirectionColumn); + const float marginAxisRow = getMarginAxis(node, YGFlexDirectionRow); - node->layout.measuredDimensions[CSSDimensionWidth] = + node->layout.measuredDimensions[YGDimensionWidth] = boundAxis(node, - CSSFlexDirectionRow, - CSSValueIsUndefined(availableWidth) || (widthMeasureMode == CSSMeasureModeAtMost && availableWidth < 0) + YGFlexDirectionRow, + CSSValueIsUndefined(availableWidth) || (widthMeasureMode == YGMeasureModeAtMost && availableWidth < 0) ? 0 : availableWidth - marginAxisRow); - node->layout.measuredDimensions[CSSDimensionHeight] = + node->layout.measuredDimensions[YGDimensionHeight] = boundAxis(node, - CSSFlexDirectionColumn, - CSSValueIsUndefined(availableHeight) || (heightMeasureMode == CSSMeasureModeAtMost && availableHeight < 0) + YGFlexDirectionColumn, + CSSValueIsUndefined(availableHeight) || (heightMeasureMode == YGMeasureModeAtMost && availableHeight < 0) ? 0 : availableHeight - marginAxisColumn); @@ -1373,7 +1363,7 @@ static bool setMeasuredDimensionsIfEmptyOrFixedSize(const CSSNodeRef node, // - node: current node to be sized and layed out // - availableWidth & availableHeight: available size to be used for sizing // the node -// or CSSUndefined if the size is not available; interpretation depends on +// or YGUndefined if the size is not available; interpretation depends on // layout // flags // - parentDirection: the inline (text) direction within the parent @@ -1410,33 +1400,33 @@ static bool setMeasuredDimensionsIfEmptyOrFixedSize(const CSSNodeRef node, // minimum main sizes (see above for details). Each of our measure modes maps // to a layout mode // from the spec (https://www.w3.org/TR/css3-sizing/#terms): -// - CSSMeasureModeUndefined: max content -// - CSSMeasureModeExactly: fill available -// - CSSMeasureModeAtMost: fit content +// - YGMeasureModeUndefined: max content +// - YGMeasureModeExactly: fill available +// - YGMeasureModeAtMost: fit content // // When calling layoutNodeImpl and layoutNodeInternal, if the caller passes // an available size of -// undefined then it must also pass a measure mode of CSSMeasureModeUndefined +// undefined then it must also pass a measure mode of YGMeasureModeUndefined // in that dimension. // static void layoutNodeImpl(const CSSNodeRef node, const float availableWidth, const float availableHeight, - const CSSDirection parentDirection, - const CSSMeasureMode widthMeasureMode, - const CSSMeasureMode heightMeasureMode, + const YGDirection parentDirection, + const YGMeasureMode widthMeasureMode, + const YGMeasureMode heightMeasureMode, const bool performLayout) { - CSS_ASSERT(CSSValueIsUndefined(availableWidth) ? widthMeasureMode == CSSMeasureModeUndefined + CSS_ASSERT(CSSValueIsUndefined(availableWidth) ? widthMeasureMode == YGMeasureModeUndefined : true, "availableWidth is indefinite so widthMeasureMode must be " - "CSSMeasureModeUndefined"); - CSS_ASSERT(CSSValueIsUndefined(availableHeight) ? heightMeasureMode == CSSMeasureModeUndefined + "YGMeasureModeUndefined"); + CSS_ASSERT(CSSValueIsUndefined(availableHeight) ? heightMeasureMode == YGMeasureModeUndefined : true, "availableHeight is indefinite so heightMeasureMode must be " - "CSSMeasureModeUndefined"); + "YGMeasureModeUndefined"); // Set the resolved resolution in the node's layout. - const CSSDirection direction = resolveDirection(node, parentDirection); + const YGDirection direction = resolveDirection(node, parentDirection); node->layout.direction = direction; if (node->measure) { @@ -1461,11 +1451,11 @@ static void layoutNodeImpl(const CSSNodeRef node, } // STEP 1: CALCULATE VALUES FOR REMAINDER OF ALGORITHM - const CSSFlexDirection mainAxis = resolveAxis(node->style.flexDirection, direction); - const CSSFlexDirection crossAxis = getCrossFlexDirection(mainAxis, direction); + const YGFlexDirection mainAxis = resolveAxis(node->style.flexDirection, direction); + const YGFlexDirection crossAxis = getCrossFlexDirection(mainAxis, direction); const bool isMainAxisRow = isRowDirection(mainAxis); - const CSSJustify justifyContent = node->style.justifyContent; - const bool isNodeFlexWrap = node->style.flexWrap == CSSWrapWrap; + const YGJustify justifyContent = node->style.justifyContent; + const bool isNodeFlexWrap = node->style.flexWrap == YGWrapWrap; CSSNodeRef firstAbsoluteChild = NULL; CSSNodeRef currentAbsoluteChild = NULL; @@ -1476,13 +1466,13 @@ static void layoutNodeImpl(const CSSNodeRef node, const float paddingAndBorderAxisMain = getPaddingAndBorderAxis(node, mainAxis); const float paddingAndBorderAxisCross = getPaddingAndBorderAxis(node, crossAxis); - const CSSMeasureMode measureModeMainDim = isMainAxisRow ? widthMeasureMode : heightMeasureMode; - const CSSMeasureMode measureModeCrossDim = isMainAxisRow ? heightMeasureMode : widthMeasureMode; + const YGMeasureMode measureModeMainDim = isMainAxisRow ? widthMeasureMode : heightMeasureMode; + const YGMeasureMode measureModeCrossDim = isMainAxisRow ? heightMeasureMode : widthMeasureMode; - const float paddingAndBorderAxisRow = getPaddingAndBorderAxis(node, CSSFlexDirectionRow); - const float paddingAndBorderAxisColumn = getPaddingAndBorderAxis(node, CSSFlexDirectionColumn); - const float marginAxisRow = getMarginAxis(node, CSSFlexDirectionRow); - const float marginAxisColumn = getMarginAxis(node, CSSFlexDirectionColumn); + const float paddingAndBorderAxisRow = getPaddingAndBorderAxis(node, YGFlexDirectionRow); + const float paddingAndBorderAxisColumn = getPaddingAndBorderAxis(node, YGFlexDirectionColumn); + const float marginAxisRow = getMarginAxis(node, YGFlexDirectionRow); + const float marginAxisColumn = getMarginAxis(node, YGFlexDirectionColumn); // STEP 2: DETERMINE AVAILABLE SIZE IN MAIN AND CROSS DIRECTIONS const float availableInnerWidth = availableWidth - marginAxisRow - paddingAndBorderAxisRow; @@ -1495,8 +1485,8 @@ static void layoutNodeImpl(const CSSNodeRef node, // computedFlexBasis to 0 instead of measuring and shrinking / flexing the child to exactly // match the remaining space CSSNodeRef singleFlexChild = NULL; - if ((isMainAxisRow && widthMeasureMode == CSSMeasureModeExactly) || - (!isMainAxisRow && heightMeasureMode == CSSMeasureModeExactly)) { + if ((isMainAxisRow && widthMeasureMode == YGMeasureModeExactly) || + (!isMainAxisRow && heightMeasureMode == YGMeasureModeExactly)) { for (uint32_t i = 0; i < childCount; i++) { const CSSNodeRef child = CSSNodeGetChild(node, i); if (singleFlexChild) { @@ -1517,13 +1507,13 @@ static void layoutNodeImpl(const CSSNodeRef node, if (performLayout) { // Set the initial position (relative to the parent). - const CSSDirection childDirection = resolveDirection(child, direction); + const YGDirection childDirection = resolveDirection(child, direction); setPosition(child, childDirection); } // Absolute-positioned children don't participate in flex layout. Add them // to a list that we can process later. - if (child->style.positionType == CSSPositionTypeAbsolute) { + if (child->style.positionType == YGPositionTypeAbsolute) { // Store a private linked list of absolutely positioned children // so that we can efficiently traverse them later. if (firstAbsoluteChild == NULL) { @@ -1590,7 +1580,7 @@ static void layoutNodeImpl(const CSSNodeRef node, const CSSNodeRef child = CSSNodeListGet(node->children, i); child->lineIndex = lineCount; - if (child->style.positionType != CSSPositionTypeAbsolute) { + if (child->style.positionType != YGPositionTypeAbsolute) { const float outerFlexBasis = child->layout.computedFlexBasis + getMarginAxis(child, mainAxis); @@ -1630,7 +1620,7 @@ static void layoutNodeImpl(const CSSNodeRef node, // If we don't need to measure the cross axis, we can skip the entire flex // step. - const bool canSkipFlex = !performLayout && measureModeCrossDim == CSSMeasureModeExactly; + const bool canSkipFlex = !performLayout && measureModeCrossDim == YGMeasureModeExactly; // In order to position the elements in the main axis, we have two // controls. The space between the beginning and the first element @@ -1785,73 +1775,73 @@ static void layoutNodeImpl(const CSSNodeRef node, float childWidth; float childHeight; - CSSMeasureMode childWidthMeasureMode; - CSSMeasureMode childHeightMeasureMode; + YGMeasureMode childWidthMeasureMode; + YGMeasureMode childHeightMeasureMode; if (isMainAxisRow) { - childWidth = updatedMainSize + getMarginAxis(currentRelativeChild, CSSFlexDirectionRow); - childWidthMeasureMode = CSSMeasureModeExactly; + childWidth = updatedMainSize + getMarginAxis(currentRelativeChild, YGFlexDirectionRow); + childWidthMeasureMode = YGMeasureModeExactly; if (!CSSValueIsUndefined(availableInnerCrossDim) && - !isStyleDimDefined(currentRelativeChild, CSSFlexDirectionColumn) && - heightMeasureMode == CSSMeasureModeExactly && - getAlignItem(node, currentRelativeChild) == CSSAlignStretch) { + !isStyleDimDefined(currentRelativeChild, YGFlexDirectionColumn) && + heightMeasureMode == YGMeasureModeExactly && + getAlignItem(node, currentRelativeChild) == YGAlignStretch) { childHeight = availableInnerCrossDim; - childHeightMeasureMode = CSSMeasureModeExactly; - } else if (!isStyleDimDefined(currentRelativeChild, CSSFlexDirectionColumn)) { + childHeightMeasureMode = YGMeasureModeExactly; + } else if (!isStyleDimDefined(currentRelativeChild, YGFlexDirectionColumn)) { childHeight = availableInnerCrossDim; childHeightMeasureMode = - CSSValueIsUndefined(childHeight) ? CSSMeasureModeUndefined : CSSMeasureModeAtMost; + CSSValueIsUndefined(childHeight) ? YGMeasureModeUndefined : YGMeasureModeAtMost; } else { - childHeight = currentRelativeChild->style.dimensions[CSSDimensionHeight] + - getMarginAxis(currentRelativeChild, CSSFlexDirectionColumn); - childHeightMeasureMode = CSSMeasureModeExactly; + childHeight = currentRelativeChild->style.dimensions[YGDimensionHeight] + + getMarginAxis(currentRelativeChild, YGFlexDirectionColumn); + childHeightMeasureMode = YGMeasureModeExactly; } } else { childHeight = - updatedMainSize + getMarginAxis(currentRelativeChild, CSSFlexDirectionColumn); - childHeightMeasureMode = CSSMeasureModeExactly; + updatedMainSize + getMarginAxis(currentRelativeChild, YGFlexDirectionColumn); + childHeightMeasureMode = YGMeasureModeExactly; if (!CSSValueIsUndefined(availableInnerCrossDim) && - !isStyleDimDefined(currentRelativeChild, CSSFlexDirectionRow) && - widthMeasureMode == CSSMeasureModeExactly && - getAlignItem(node, currentRelativeChild) == CSSAlignStretch) { + !isStyleDimDefined(currentRelativeChild, YGFlexDirectionRow) && + widthMeasureMode == YGMeasureModeExactly && + getAlignItem(node, currentRelativeChild) == YGAlignStretch) { childWidth = availableInnerCrossDim; - childWidthMeasureMode = CSSMeasureModeExactly; - } else if (!isStyleDimDefined(currentRelativeChild, CSSFlexDirectionRow)) { + childWidthMeasureMode = YGMeasureModeExactly; + } else if (!isStyleDimDefined(currentRelativeChild, YGFlexDirectionRow)) { childWidth = availableInnerCrossDim; childWidthMeasureMode = - CSSValueIsUndefined(childWidth) ? CSSMeasureModeUndefined : CSSMeasureModeAtMost; + CSSValueIsUndefined(childWidth) ? YGMeasureModeUndefined : YGMeasureModeAtMost; } else { - childWidth = currentRelativeChild->style.dimensions[CSSDimensionWidth] + - getMarginAxis(currentRelativeChild, CSSFlexDirectionRow); - childWidthMeasureMode = CSSMeasureModeExactly; + childWidth = currentRelativeChild->style.dimensions[YGDimensionWidth] + + getMarginAxis(currentRelativeChild, YGFlexDirectionRow); + childWidthMeasureMode = YGMeasureModeExactly; } } if (!CSSValueIsUndefined(currentRelativeChild->style.aspectRatio)) { - if (isMainAxisRow && childHeightMeasureMode != CSSMeasureModeExactly) { + if (isMainAxisRow && childHeightMeasureMode != YGMeasureModeExactly) { childHeight = fmaxf(childWidth * currentRelativeChild->style.aspectRatio, - getPaddingAndBorderAxis(currentRelativeChild, CSSFlexDirectionColumn)); - childHeightMeasureMode = CSSMeasureModeExactly; - } else if (!isMainAxisRow && childWidthMeasureMode != CSSMeasureModeExactly) { + getPaddingAndBorderAxis(currentRelativeChild, YGFlexDirectionColumn)); + childHeightMeasureMode = YGMeasureModeExactly; + } else if (!isMainAxisRow && childWidthMeasureMode != YGMeasureModeExactly) { childWidth = fmaxf(childHeight * currentRelativeChild->style.aspectRatio, - getPaddingAndBorderAxis(currentRelativeChild, CSSFlexDirectionRow)); - childWidthMeasureMode = CSSMeasureModeExactly; + getPaddingAndBorderAxis(currentRelativeChild, YGFlexDirectionRow)); + childWidthMeasureMode = YGMeasureModeExactly; } } - constrainMaxSizeForMode(currentRelativeChild->style.maxDimensions[CSSDimensionWidth], + constrainMaxSizeForMode(currentRelativeChild->style.maxDimensions[YGDimensionWidth], &childWidthMeasureMode, &childWidth); - constrainMaxSizeForMode(currentRelativeChild->style.maxDimensions[CSSDimensionHeight], + constrainMaxSizeForMode(currentRelativeChild->style.maxDimensions[YGDimensionHeight], &childHeightMeasureMode, &childHeight); const bool requiresStretchLayout = !isStyleDimDefined(currentRelativeChild, crossAxis) && - getAlignItem(node, currentRelativeChild) == CSSAlignStretch; + getAlignItem(node, currentRelativeChild) == YGAlignStretch; // Recursively call the layout algorithm for this child with the updated // main size. @@ -1882,7 +1872,7 @@ static void layoutNodeImpl(const CSSNodeRef node, // If we are using "at most" rules in the main axis. Calculate the remaining space when // constraint by the min size defined for the main axis. - if (measureModeMainDim == CSSMeasureModeAtMost && remainingFreeSpace > 0) { + if (measureModeMainDim == YGMeasureModeAtMost && remainingFreeSpace > 0) { if (!CSSValueIsUndefined(node->style.minDimensions[dim[mainAxis]]) && node->style.minDimensions[dim[mainAxis]] >= 0) { remainingFreeSpace = fmaxf(0, @@ -1894,26 +1884,26 @@ static void layoutNodeImpl(const CSSNodeRef node, } switch (justifyContent) { - case CSSJustifyCenter: + case YGJustifyCenter: leadingMainDim = remainingFreeSpace / 2; break; - case CSSJustifyFlexEnd: + case YGJustifyFlexEnd: leadingMainDim = remainingFreeSpace; break; - case CSSJustifySpaceBetween: + case YGJustifySpaceBetween: if (itemsOnLine > 1) { betweenMainDim = fmaxf(remainingFreeSpace, 0) / (itemsOnLine - 1); } else { betweenMainDim = 0; } break; - case CSSJustifySpaceAround: + case YGJustifySpaceAround: // Space on the edges is half of the space between elements betweenMainDim = remainingFreeSpace / itemsOnLine; leadingMainDim = betweenMainDim / 2; break; - case CSSJustifyFlexStart: - case CSSJustifyCount: + case YGJustifyFlexStart: + case YGJustifyCount: break; } @@ -1923,7 +1913,7 @@ static void layoutNodeImpl(const CSSNodeRef node, for (uint32_t i = startOfLineIndex; i < endOfLineIndex; i++) { const CSSNodeRef child = CSSNodeListGet(node->children, i); - if (child->style.positionType == CSSPositionTypeAbsolute && + if (child->style.positionType == YGPositionTypeAbsolute && isLeadingPosDefined(child, mainAxis)) { if (performLayout) { // In case the child is position absolute and has left/top being @@ -1937,7 +1927,7 @@ static void layoutNodeImpl(const CSSNodeRef node, // Now that we placed the element, we need to update the variables. // We need to do that only for relative elements. Absolute elements // do not take part in that phase. - if (child->style.positionType == CSSPositionTypeRelative) { + if (child->style.positionType == YGPositionTypeRelative) { if (performLayout) { child->layout.position[pos[mainAxis]] += mainDim; } @@ -1969,19 +1959,19 @@ static void layoutNodeImpl(const CSSNodeRef node, mainDim += trailingPaddingAndBorderMain; float containerCrossAxis = availableInnerCrossDim; - if (measureModeCrossDim == CSSMeasureModeUndefined || - measureModeCrossDim == CSSMeasureModeAtMost) { + if (measureModeCrossDim == YGMeasureModeUndefined || + measureModeCrossDim == YGMeasureModeAtMost) { // Compute the cross axis from the max cross dimension of the children. containerCrossAxis = boundAxis(node, crossAxis, crossDim + paddingAndBorderAxisCross) - paddingAndBorderAxisCross; - if (measureModeCrossDim == CSSMeasureModeAtMost) { + if (measureModeCrossDim == YGMeasureModeAtMost) { containerCrossAxis = fminf(containerCrossAxis, availableInnerCrossDim); } } // If there's no flex wrap, the cross dimension is defined by the container. - if (!isNodeFlexWrap && measureModeCrossDim == CSSMeasureModeExactly) { + if (!isNodeFlexWrap && measureModeCrossDim == YGMeasureModeExactly) { crossDim = availableInnerCrossDim; } @@ -1995,7 +1985,7 @@ static void layoutNodeImpl(const CSSNodeRef node, for (uint32_t i = startOfLineIndex; i < endOfLineIndex; i++) { const CSSNodeRef child = CSSNodeListGet(node->children, i); - if (child->style.positionType == CSSPositionTypeAbsolute) { + if (child->style.positionType == YGPositionTypeAbsolute) { // If the child is absolutely positioned and has a // top/left/bottom/right // set, override all the previously computed positions to set it @@ -2014,36 +2004,36 @@ static void layoutNodeImpl(const CSSNodeRef node, // For a relative children, we're either using alignItems (parent) or // alignSelf (child) in order to determine the position in the cross // axis - const CSSAlign alignItem = getAlignItem(node, child); + const YGAlign alignItem = getAlignItem(node, child); // If the child uses align stretch, we need to lay it out one more // time, this time // forcing the cross-axis size to be the computed cross size for the // current line. - if (alignItem == CSSAlignStretch) { + if (alignItem == YGAlignStretch) { const bool isCrossSizeDefinite = - (isMainAxisRow && isStyleDimDefined(child, CSSFlexDirectionColumn)) || - (!isMainAxisRow && isStyleDimDefined(child, CSSFlexDirectionRow)); + (isMainAxisRow && isStyleDimDefined(child, YGFlexDirectionColumn)) || + (!isMainAxisRow && isStyleDimDefined(child, YGFlexDirectionRow)); float childWidth; float childHeight; - CSSMeasureMode childWidthMeasureMode = CSSMeasureModeExactly; - CSSMeasureMode childHeightMeasureMode = CSSMeasureModeExactly; + YGMeasureMode childWidthMeasureMode = YGMeasureModeExactly; + YGMeasureMode childHeightMeasureMode = YGMeasureModeExactly; if (isMainAxisRow) { childHeight = crossDim; - childWidth = child->layout.measuredDimensions[CSSDimensionWidth] + - getMarginAxis(child, CSSFlexDirectionRow); + childWidth = child->layout.measuredDimensions[YGDimensionWidth] + + getMarginAxis(child, YGFlexDirectionRow); } else { childWidth = crossDim; - childHeight = child->layout.measuredDimensions[CSSDimensionHeight] + - getMarginAxis(child, CSSFlexDirectionColumn); + childHeight = child->layout.measuredDimensions[YGDimensionHeight] + + getMarginAxis(child, YGFlexDirectionColumn); } - constrainMaxSizeForMode(child->style.maxDimensions[CSSDimensionWidth], + constrainMaxSizeForMode(child->style.maxDimensions[YGDimensionWidth], &childWidthMeasureMode, &childWidth); - constrainMaxSizeForMode(child->style.maxDimensions[CSSDimensionHeight], + constrainMaxSizeForMode(child->style.maxDimensions[YGDimensionHeight], &childHeightMeasureMode, &childHeight); @@ -2051,9 +2041,9 @@ static void layoutNodeImpl(const CSSNodeRef node, // no need to stretch. if (!isCrossSizeDefinite) { childWidthMeasureMode = - CSSValueIsUndefined(childWidth) ? CSSMeasureModeUndefined : CSSMeasureModeExactly; - childHeightMeasureMode = CSSValueIsUndefined(childHeight) ? CSSMeasureModeUndefined - : CSSMeasureModeExactly; + CSSValueIsUndefined(childWidth) ? YGMeasureModeUndefined : YGMeasureModeExactly; + childHeightMeasureMode = + CSSValueIsUndefined(childHeight) ? YGMeasureModeUndefined : YGMeasureModeExactly; layoutNodeInternal(child, childWidth, @@ -2064,12 +2054,12 @@ static void layoutNodeImpl(const CSSNodeRef node, true, "stretch"); } - } else if (alignItem != CSSAlignFlexStart) { + } else if (alignItem != YGAlignFlexStart) { const float remainingCrossDim = containerCrossAxis - getDimWithMargin(child, crossAxis); - if (alignItem == CSSAlignCenter) { + if (alignItem == YGAlignCenter) { leadingCrossDim += remainingCrossDim / 2; - } else { // CSSAlignFlexEnd + } else { // YGAlignFlexEnd leadingCrossDim += remainingCrossDim; } } @@ -2092,20 +2082,20 @@ static void layoutNodeImpl(const CSSNodeRef node, float currentLead = leadingPaddingAndBorderCross; switch (node->style.alignContent) { - case CSSAlignFlexEnd: + case YGAlignFlexEnd: currentLead += remainingAlignContentDim; break; - case CSSAlignCenter: + case YGAlignCenter: currentLead += remainingAlignContentDim / 2; break; - case CSSAlignStretch: + case YGAlignStretch: if (availableInnerCrossDim > totalLineCrossDim) { crossDimLead = (remainingAlignContentDim / lineCount); } break; - case CSSAlignAuto: - case CSSAlignFlexStart: - case CSSAlignCount: + case YGAlignAuto: + case YGAlignFlexStart: + case YGAlignCount: break; } @@ -2119,7 +2109,7 @@ static void layoutNodeImpl(const CSSNodeRef node, for (ii = startIndex; ii < childCount; ii++) { const CSSNodeRef child = CSSNodeListGet(node->children, ii); - if (child->style.positionType == CSSPositionTypeRelative) { + if (child->style.positionType == YGPositionTypeRelative) { if (child->lineIndex != i) { break; } @@ -2138,34 +2128,34 @@ static void layoutNodeImpl(const CSSNodeRef node, for (ii = startIndex; ii < endIndex; ii++) { const CSSNodeRef child = CSSNodeListGet(node->children, ii); - if (child->style.positionType == CSSPositionTypeRelative) { + if (child->style.positionType == YGPositionTypeRelative) { switch (getAlignItem(node, child)) { - case CSSAlignFlexStart: { + case YGAlignFlexStart: { child->layout.position[pos[crossAxis]] = currentLead + getLeadingMargin(child, crossAxis); break; } - case CSSAlignFlexEnd: { + case YGAlignFlexEnd: { child->layout.position[pos[crossAxis]] = currentLead + lineHeight - getTrailingMargin(child, crossAxis) - child->layout.measuredDimensions[dim[crossAxis]]; break; } - case CSSAlignCenter: { + case YGAlignCenter: { float childHeight = child->layout.measuredDimensions[dim[crossAxis]]; child->layout.position[pos[crossAxis]] = currentLead + (lineHeight - childHeight) / 2; break; } - case CSSAlignStretch: { + case YGAlignStretch: { child->layout.position[pos[crossAxis]] = currentLead + getLeadingMargin(child, crossAxis); // TODO(prenaux): Correctly set the height of items with indefinite // (auto) crossAxis dimension. break; } - case CSSAlignAuto: - case CSSAlignCount: + case YGAlignAuto: + case YGAlignCount: break; } } @@ -2177,30 +2167,30 @@ static void layoutNodeImpl(const CSSNodeRef node, } // STEP 9: COMPUTING FINAL DIMENSIONS - node->layout.measuredDimensions[CSSDimensionWidth] = - boundAxis(node, CSSFlexDirectionRow, availableWidth - marginAxisRow); - node->layout.measuredDimensions[CSSDimensionHeight] = - boundAxis(node, CSSFlexDirectionColumn, availableHeight - marginAxisColumn); + node->layout.measuredDimensions[YGDimensionWidth] = + boundAxis(node, YGFlexDirectionRow, availableWidth - marginAxisRow); + node->layout.measuredDimensions[YGDimensionHeight] = + boundAxis(node, YGFlexDirectionColumn, availableHeight - marginAxisColumn); // If the user didn't specify a width or height for the node, set the // dimensions based on the children. - if (measureModeMainDim == CSSMeasureModeUndefined) { + if (measureModeMainDim == YGMeasureModeUndefined) { // Clamp the size to the min/max size, if specified, and make sure it // doesn't go below the padding and border amount. node->layout.measuredDimensions[dim[mainAxis]] = boundAxis(node, mainAxis, maxLineMainDim); - } else if (measureModeMainDim == CSSMeasureModeAtMost) { + } else if (measureModeMainDim == YGMeasureModeAtMost) { node->layout.measuredDimensions[dim[mainAxis]] = fmaxf(fminf(availableInnerMainDim + paddingAndBorderAxisMain, boundAxisWithinMinAndMax(node, mainAxis, maxLineMainDim)), paddingAndBorderAxisMain); } - if (measureModeCrossDim == CSSMeasureModeUndefined) { + if (measureModeCrossDim == YGMeasureModeUndefined) { // Clamp the size to the min/max size, if specified, and make sure it // doesn't go below the padding and border amount. node->layout.measuredDimensions[dim[crossAxis]] = boundAxis(node, crossAxis, totalLineCrossDim + paddingAndBorderAxisCross); - } else if (measureModeCrossDim == CSSMeasureModeAtMost) { + } else if (measureModeCrossDim == YGMeasureModeAtMost) { node->layout.measuredDimensions[dim[crossAxis]] = fmaxf(fminf(availableInnerCrossDim + paddingAndBorderAxisCross, boundAxisWithinMinAndMax(node, @@ -2219,9 +2209,9 @@ static void layoutNodeImpl(const CSSNodeRef node, // STEP 11: SETTING TRAILING POSITIONS FOR CHILDREN const bool needsMainTrailingPos = - mainAxis == CSSFlexDirectionRowReverse || mainAxis == CSSFlexDirectionColumnReverse; + mainAxis == YGFlexDirectionRowReverse || mainAxis == YGFlexDirectionColumnReverse; const bool needsCrossTrailingPos = - CSSFlexDirectionRowReverse || crossAxis == CSSFlexDirectionColumnReverse; + YGFlexDirectionRowReverse || crossAxis == YGFlexDirectionColumnReverse; // Set trailing position if necessary. if (needsMainTrailingPos || needsCrossTrailingPos) { @@ -2256,50 +2246,50 @@ static const char *getSpacer(const unsigned long level) { } } -static const char *getModeName(const CSSMeasureMode mode, const bool performLayout) { - const char *kMeasureModeNames[CSSMeasureModeCount] = {"UNDEFINED", "EXACTLY", "AT_MOST"}; - const char *kLayoutModeNames[CSSMeasureModeCount] = {"LAY_UNDEFINED", - "LAY_EXACTLY", - "LAY_AT_" - "MOST"}; +static const char *getModeName(const YGMeasureMode mode, const bool performLayout) { + const char *kMeasureModeNames[YGMeasureModeCount] = {"UNDEFINED", "EXACTLY", "AT_MOST"}; + const char *kLayoutModeNames[YGMeasureModeCount] = {"LAY_UNDEFINED", + "LAY_EXACTLY", + "LAY_AT_" + "MOST"}; - if (mode >= CSSMeasureModeCount) { + if (mode >= YGMeasureModeCount) { return ""; } return performLayout ? kLayoutModeNames[mode] : kMeasureModeNames[mode]; } -static inline bool newSizeIsExactAndMatchesOldMeasuredSize(CSSMeasureMode sizeMode, +static inline bool newSizeIsExactAndMatchesOldMeasuredSize(YGMeasureMode sizeMode, float size, float lastComputedSize) { - return sizeMode == CSSMeasureModeExactly && eq(size, lastComputedSize); + return sizeMode == YGMeasureModeExactly && eq(size, lastComputedSize); } -static inline bool oldSizeIsUnspecifiedAndStillFits(CSSMeasureMode sizeMode, +static inline bool oldSizeIsUnspecifiedAndStillFits(YGMeasureMode sizeMode, float size, - CSSMeasureMode lastSizeMode, + YGMeasureMode lastSizeMode, float lastComputedSize) { - return sizeMode == CSSMeasureModeAtMost && lastSizeMode == CSSMeasureModeUndefined && + return sizeMode == YGMeasureModeAtMost && lastSizeMode == YGMeasureModeUndefined && size >= lastComputedSize; } -static inline bool newMeasureSizeIsStricterAndStillValid(CSSMeasureMode sizeMode, +static inline bool newMeasureSizeIsStricterAndStillValid(YGMeasureMode sizeMode, float size, - CSSMeasureMode lastSizeMode, + YGMeasureMode lastSizeMode, float lastSize, float lastComputedSize) { - return lastSizeMode == CSSMeasureModeAtMost && sizeMode == CSSMeasureModeAtMost && + return lastSizeMode == YGMeasureModeAtMost && sizeMode == YGMeasureModeAtMost && lastSize > size && lastComputedSize <= size; } -bool CSSNodeCanUseCachedMeasurement(const CSSMeasureMode widthMode, +bool CSSNodeCanUseCachedMeasurement(const YGMeasureMode widthMode, const float width, - const CSSMeasureMode heightMode, + const YGMeasureMode heightMode, const float height, - const CSSMeasureMode lastWidthMode, + const YGMeasureMode lastWidthMode, const float lastWidth, - const CSSMeasureMode lastHeightMode, + const YGMeasureMode lastHeightMode, const float lastHeight, const float lastComputedWidth, const float lastComputedHeight, @@ -2347,9 +2337,9 @@ bool CSSNodeCanUseCachedMeasurement(const CSSMeasureMode widthMode, bool layoutNodeInternal(const CSSNodeRef node, const float availableWidth, const float availableHeight, - const CSSDirection parentDirection, - const CSSMeasureMode widthMeasureMode, - const CSSMeasureMode heightMeasureMode, + const YGDirection parentDirection, + const YGMeasureMode widthMeasureMode, + const YGMeasureMode heightMeasureMode, const bool performLayout, const char *reason) { CSSLayout *layout = &node->layout; @@ -2363,8 +2353,8 @@ bool layoutNodeInternal(const CSSNodeRef node, if (needToVisitNode) { // Invalidate the cached results. layout->nextCachedMeasurementsIndex = 0; - layout->cachedLayout.widthMeasureMode = (CSSMeasureMode) -1; - layout->cachedLayout.heightMeasureMode = (CSSMeasureMode) -1; + layout->cachedLayout.widthMeasureMode = (YGMeasureMode) -1; + layout->cachedLayout.heightMeasureMode = (YGMeasureMode) -1; layout->cachedLayout.computedWidth = -1; layout->cachedLayout.computedHeight = -1; } @@ -2384,8 +2374,8 @@ bool layoutNodeInternal(const CSSNodeRef node, // expensive to measure, so it's worth avoiding redundant measurements if at // all possible. if (node->measure) { - const float marginAxisRow = getMarginAxis(node, CSSFlexDirectionRow); - const float marginAxisColumn = getMarginAxis(node, CSSFlexDirectionColumn); + const float marginAxisRow = getMarginAxis(node, YGFlexDirectionRow); + const float marginAxisColumn = getMarginAxis(node, YGFlexDirectionColumn); // First, try to use the layout cache. if (CSSNodeCanUseCachedMeasurement(widthMeasureMode, @@ -2441,8 +2431,8 @@ bool layoutNodeInternal(const CSSNodeRef node, } if (!needToVisitNode && cachedResults != NULL) { - layout->measuredDimensions[CSSDimensionWidth] = cachedResults->computedWidth; - layout->measuredDimensions[CSSDimensionHeight] = cachedResults->computedHeight; + layout->measuredDimensions[YGDimensionWidth] = cachedResults->computedWidth; + layout->measuredDimensions[YGDimensionHeight] = cachedResults->computedHeight; if (gPrintChanges && gPrintSkips) { printf("%s%d.{[skipped] ", getSpacer(gDepth), gDepth); @@ -2488,8 +2478,8 @@ bool layoutNodeInternal(const CSSNodeRef node, printf("wm: %s, hm: %s, d: (%f, %f) %s\n", getModeName(widthMeasureMode, performLayout), getModeName(heightMeasureMode, performLayout), - layout->measuredDimensions[CSSDimensionWidth], - layout->measuredDimensions[CSSDimensionHeight], + layout->measuredDimensions[YGDimensionWidth], + layout->measuredDimensions[YGDimensionHeight], reason); } @@ -2517,15 +2507,14 @@ bool layoutNodeInternal(const CSSNodeRef node, newCacheEntry->availableHeight = availableHeight; newCacheEntry->widthMeasureMode = widthMeasureMode; newCacheEntry->heightMeasureMode = heightMeasureMode; - newCacheEntry->computedWidth = layout->measuredDimensions[CSSDimensionWidth]; - newCacheEntry->computedHeight = layout->measuredDimensions[CSSDimensionHeight]; + newCacheEntry->computedWidth = layout->measuredDimensions[YGDimensionWidth]; + newCacheEntry->computedHeight = layout->measuredDimensions[YGDimensionHeight]; } } if (performLayout) { - node->layout.dimensions[CSSDimensionWidth] = node->layout.measuredDimensions[CSSDimensionWidth]; - node->layout.dimensions[CSSDimensionHeight] = - node->layout.measuredDimensions[CSSDimensionHeight]; + node->layout.dimensions[YGDimensionWidth] = node->layout.measuredDimensions[YGDimensionWidth]; + node->layout.dimensions[YGDimensionHeight] = node->layout.measuredDimensions[YGDimensionHeight]; node->hasNewLayout = true; node->isDirty = false; } @@ -2537,16 +2526,16 @@ bool layoutNodeInternal(const CSSNodeRef node, static void roundToPixelGrid(const CSSNodeRef node) { const float fractialLeft = - node->layout.position[CSSEdgeLeft] - floorf(node->layout.position[CSSEdgeLeft]); + node->layout.position[YGEdgeLeft] - floorf(node->layout.position[YGEdgeLeft]); const float fractialTop = - node->layout.position[CSSEdgeTop] - floorf(node->layout.position[CSSEdgeTop]); - node->layout.dimensions[CSSDimensionWidth] = - roundf(fractialLeft + node->layout.dimensions[CSSDimensionWidth]) - roundf(fractialLeft); - node->layout.dimensions[CSSDimensionHeight] = - roundf(fractialTop + node->layout.dimensions[CSSDimensionHeight]) - roundf(fractialTop); + node->layout.position[YGEdgeTop] - floorf(node->layout.position[YGEdgeTop]); + node->layout.dimensions[YGDimensionWidth] = + roundf(fractialLeft + node->layout.dimensions[YGDimensionWidth]) - roundf(fractialLeft); + node->layout.dimensions[YGDimensionHeight] = + roundf(fractialTop + node->layout.dimensions[YGDimensionHeight]) - roundf(fractialTop); - node->layout.position[CSSEdgeLeft] = roundf(node->layout.position[CSSEdgeLeft]); - node->layout.position[CSSEdgeTop] = roundf(node->layout.position[CSSEdgeTop]); + node->layout.position[YGEdgeLeft] = roundf(node->layout.position[YGEdgeLeft]); + node->layout.position[YGEdgeTop] = roundf(node->layout.position[YGEdgeTop]); const uint32_t childCount = CSSNodeListCount(node->children); for (uint32_t i = 0; i < childCount; i++) { @@ -2557,7 +2546,7 @@ static void roundToPixelGrid(const CSSNodeRef node) { void CSSNodeCalculateLayout(const CSSNodeRef node, const float availableWidth, const float availableHeight, - const CSSDirection parentDirection) { + const YGDirection parentDirection) { // Increment the generation count. This will force the recursive routine to // visit // all dirty nodes at least once. Subsequent visits will be skipped if the @@ -2567,29 +2556,29 @@ void CSSNodeCalculateLayout(const CSSNodeRef node, float width = availableWidth; float height = availableHeight; - CSSMeasureMode widthMeasureMode = CSSMeasureModeUndefined; - CSSMeasureMode heightMeasureMode = CSSMeasureModeUndefined; + YGMeasureMode widthMeasureMode = YGMeasureModeUndefined; + YGMeasureMode heightMeasureMode = YGMeasureModeUndefined; if (!CSSValueIsUndefined(width)) { - widthMeasureMode = CSSMeasureModeExactly; - } else if (isStyleDimDefined(node, CSSFlexDirectionRow)) { + widthMeasureMode = YGMeasureModeExactly; + } else if (isStyleDimDefined(node, YGFlexDirectionRow)) { width = - node->style.dimensions[dim[CSSFlexDirectionRow]] + getMarginAxis(node, CSSFlexDirectionRow); - widthMeasureMode = CSSMeasureModeExactly; - } else if (node->style.maxDimensions[CSSDimensionWidth] >= 0.0) { - width = node->style.maxDimensions[CSSDimensionWidth]; - widthMeasureMode = CSSMeasureModeAtMost; + node->style.dimensions[dim[YGFlexDirectionRow]] + getMarginAxis(node, YGFlexDirectionRow); + widthMeasureMode = YGMeasureModeExactly; + } else if (node->style.maxDimensions[YGDimensionWidth] >= 0.0) { + width = node->style.maxDimensions[YGDimensionWidth]; + widthMeasureMode = YGMeasureModeAtMost; } if (!CSSValueIsUndefined(height)) { - heightMeasureMode = CSSMeasureModeExactly; - } else if (isStyleDimDefined(node, CSSFlexDirectionColumn)) { - height = node->style.dimensions[dim[CSSFlexDirectionColumn]] + - getMarginAxis(node, CSSFlexDirectionColumn); - heightMeasureMode = CSSMeasureModeExactly; - } else if (node->style.maxDimensions[CSSDimensionHeight] >= 0.0) { - height = node->style.maxDimensions[CSSDimensionHeight]; - heightMeasureMode = CSSMeasureModeAtMost; + heightMeasureMode = YGMeasureModeExactly; + } else if (isStyleDimDefined(node, YGFlexDirectionColumn)) { + height = node->style.dimensions[dim[YGFlexDirectionColumn]] + + getMarginAxis(node, YGFlexDirectionColumn); + heightMeasureMode = YGMeasureModeExactly; + } else if (node->style.maxDimensions[YGDimensionHeight] >= 0.0) { + height = node->style.maxDimensions[YGDimensionHeight]; + heightMeasureMode = YGMeasureModeAtMost; } if (layoutNodeInternal(node, @@ -2603,12 +2592,12 @@ void CSSNodeCalculateLayout(const CSSNodeRef node, "l")) { setPosition(node, node->layout.direction); - if (CSSLayoutIsExperimentalFeatureEnabled(CSSExperimentalFeatureRounding)) { + if (CSSLayoutIsExperimentalFeatureEnabled(YGExperimentalFeatureRounding)) { roundToPixelGrid(node); } if (gPrintTree) { - CSSNodePrint(node, CSSPrintOptionsLayout | CSSPrintOptionsChildren | CSSPrintOptionsStyle); + CSSNodePrint(node, YGPrintOptionsLayout | YGPrintOptionsChildren | YGPrintOptionsStyle); } } } @@ -2617,20 +2606,20 @@ void CSSLayoutSetLogger(CSSLogger logger) { gLogger = logger; } -void CSSLog(CSSLogLevel level, const char *format, ...) { +void CSSLog(YGLogLevel level, const char *format, ...) { va_list args; va_start(args, format); gLogger(level, format, args); va_end(args); } -static bool experimentalFeatures[CSSExperimentalFeatureCount + 1]; +static bool experimentalFeatures[YGExperimentalFeatureCount + 1]; -void CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeature feature, bool enabled) { +void CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeature feature, bool enabled) { experimentalFeatures[feature] = enabled; } -inline bool CSSLayoutIsExperimentalFeatureEnabled(CSSExperimentalFeature feature) { +inline bool CSSLayoutIsExperimentalFeatureEnabled(YGExperimentalFeature feature) { return experimentalFeatures[feature]; } diff --git a/CSSLayout/CSSLayout.h b/CSSLayout/CSSLayout.h index e2dca0a7..62f5b16c 100644 --- a/CSSLayout/CSSLayout.h +++ b/CSSLayout/CSSLayout.h @@ -26,7 +26,7 @@ static const unsigned long __nan[2] = {0xffffffff, 0x7fffffff}; #define NAN (*(const float *) __nan) #endif -#define CSSUndefined NAN +#define YGUndefined NAN #include "CSSEnums.h" #include "CSSMacros.h" @@ -41,11 +41,11 @@ typedef struct CSSSize { typedef struct CSSNode *CSSNodeRef; typedef CSSSize (*CSSMeasureFunc)(CSSNodeRef node, float width, - CSSMeasureMode widthMode, + YGMeasureMode widthMode, float height, - CSSMeasureMode heightMode); + YGMeasureMode heightMode); typedef void (*CSSPrintFunc)(CSSNodeRef node); -typedef int (*CSSLogger)(CSSLogLevel level, const char *format, va_list args); +typedef int (*CSSLogger)(YGLogLevel level, const char *format, va_list args); typedef void *(*CSSMalloc)(size_t size); typedef void *(*CSSCalloc)(size_t count, size_t size); @@ -70,7 +70,7 @@ WIN_EXPORT uint32_t CSSNodeChildCount(const CSSNodeRef node); WIN_EXPORT void CSSNodeCalculateLayout(const CSSNodeRef node, const float availableWidth, const float availableHeight, - const CSSDirection parentDirection); + const YGDirection parentDirection); // Mark a node as dirty. Only valid for nodes with a custom measure function // set. @@ -81,17 +81,17 @@ WIN_EXPORT void CSSNodeCalculateLayout(const CSSNodeRef node, WIN_EXPORT void CSSNodeMarkDirty(const CSSNodeRef node); WIN_EXPORT bool CSSNodeIsDirty(const CSSNodeRef node); -WIN_EXPORT void CSSNodePrint(const CSSNodeRef node, const CSSPrintOptions options); +WIN_EXPORT void CSSNodePrint(const CSSNodeRef node, const YGPrintOptions options); WIN_EXPORT bool CSSValueIsUndefined(const float value); -WIN_EXPORT bool CSSNodeCanUseCachedMeasurement(const CSSMeasureMode widthMode, +WIN_EXPORT bool CSSNodeCanUseCachedMeasurement(const YGMeasureMode widthMode, const float width, - const CSSMeasureMode heightMode, + const YGMeasureMode heightMode, const float height, - const CSSMeasureMode lastWidthMode, + const YGMeasureMode lastWidthMode, const float lastWidth, - const CSSMeasureMode lastHeightMode, + const YGMeasureMode lastHeightMode, const float lastHeight, const float lastComputedWidth, const float lastComputedHeight, @@ -110,9 +110,9 @@ WIN_EXPORT void CSSNodeCopyStyle(const CSSNodeRef dstNode, const CSSNodeRef srcN #define CSS_NODE_STYLE_EDGE_PROPERTY(type, name, paramName) \ WIN_EXPORT void CSSNodeStyleSet##name(const CSSNodeRef node, \ - const CSSEdge edge, \ + const YGEdge edge, \ const type paramName); \ - WIN_EXPORT type CSSNodeStyleGet##name(const CSSNodeRef node, const CSSEdge edge); + WIN_EXPORT type CSSNodeStyleGet##name(const CSSNodeRef node, const YGEdge edge); #define CSS_NODE_LAYOUT_PROPERTY(type, name) \ WIN_EXPORT type CSSNodeLayoutGet##name(const CSSNodeRef node); @@ -122,15 +122,15 @@ CSS_NODE_PROPERTY(CSSMeasureFunc, MeasureFunc, measureFunc); CSS_NODE_PROPERTY(CSSPrintFunc, PrintFunc, printFunc); CSS_NODE_PROPERTY(bool, HasNewLayout, hasNewLayout); -CSS_NODE_STYLE_PROPERTY(CSSDirection, Direction, direction); -CSS_NODE_STYLE_PROPERTY(CSSFlexDirection, FlexDirection, flexDirection); -CSS_NODE_STYLE_PROPERTY(CSSJustify, JustifyContent, justifyContent); -CSS_NODE_STYLE_PROPERTY(CSSAlign, AlignContent, alignContent); -CSS_NODE_STYLE_PROPERTY(CSSAlign, AlignItems, alignItems); -CSS_NODE_STYLE_PROPERTY(CSSAlign, AlignSelf, alignSelf); -CSS_NODE_STYLE_PROPERTY(CSSPositionType, PositionType, positionType); -CSS_NODE_STYLE_PROPERTY(CSSWrap, FlexWrap, flexWrap); -CSS_NODE_STYLE_PROPERTY(CSSOverflow, Overflow, overflow); +CSS_NODE_STYLE_PROPERTY(YGDirection, Direction, direction); +CSS_NODE_STYLE_PROPERTY(YGFlexDirection, FlexDirection, flexDirection); +CSS_NODE_STYLE_PROPERTY(YGJustify, JustifyContent, justifyContent); +CSS_NODE_STYLE_PROPERTY(YGAlign, AlignContent, alignContent); +CSS_NODE_STYLE_PROPERTY(YGAlign, AlignItems, alignItems); +CSS_NODE_STYLE_PROPERTY(YGAlign, AlignSelf, alignSelf); +CSS_NODE_STYLE_PROPERTY(YGPositionType, PositionType, positionType); +CSS_NODE_STYLE_PROPERTY(YGWrap, FlexWrap, flexWrap); +CSS_NODE_STYLE_PROPERTY(YGOverflow, Overflow, overflow); WIN_EXPORT void CSSNodeStyleSetFlex(const CSSNodeRef node, const float flex); CSS_NODE_STYLE_PROPERTY(float, FlexGrow, flexGrow); @@ -167,14 +167,13 @@ CSS_NODE_LAYOUT_PROPERTY(float, Right); CSS_NODE_LAYOUT_PROPERTY(float, Bottom); CSS_NODE_LAYOUT_PROPERTY(float, Width); CSS_NODE_LAYOUT_PROPERTY(float, Height); -CSS_NODE_LAYOUT_PROPERTY(CSSDirection, Direction); +CSS_NODE_LAYOUT_PROPERTY(YGDirection, Direction); WIN_EXPORT void CSSLayoutSetLogger(CSSLogger logger); -WIN_EXPORT void CSSLog(CSSLogLevel level, const char *message, ...); +WIN_EXPORT void CSSLog(YGLogLevel level, const char *message, ...); -WIN_EXPORT void CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeature feature, - bool enabled); -WIN_EXPORT bool CSSLayoutIsExperimentalFeatureEnabled(CSSExperimentalFeature feature); +WIN_EXPORT void CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeature feature, bool enabled); +WIN_EXPORT bool CSSLayoutIsExperimentalFeatureEnabled(YGExperimentalFeature feature); WIN_EXPORT void CSSLayoutSetMemoryFuncs(CSSMalloc cssMalloc, CSSCalloc cssCalloc, diff --git a/CSSLayout/CSSMacros.h b/CSSLayout/CSSMacros.h index 8d2375e5..f54a5b87 100644 --- a/CSSLayout/CSSMacros.h +++ b/CSSLayout/CSSMacros.h @@ -34,9 +34,9 @@ #endif #ifndef CSS_ASSERT -#define CSS_ASSERT(X, message) \ - if (!(X)) { \ - CSSLog(CSSLogLevelError, "%s", message); \ - CSS_ABORT(); \ +#define CSS_ASSERT(X, message) \ + if (!(X)) { \ + CSSLog(YGLogLevelError, "%s", message); \ + CSS_ABORT(); \ } #endif diff --git a/CSSLayoutKit/Tests/CSSLayoutKitTests.m b/CSSLayoutKit/Tests/CSSLayoutKitTests.m index 22b159b2..b125f382 100644 --- a/CSSLayoutKit/Tests/CSSLayoutKitTests.m +++ b/CSSLayoutKit/Tests/CSSLayoutKitTests.m @@ -74,8 +74,8 @@ { UIView *container = [[UIView alloc] initWithFrame:CGRectZero]; [container css_setUsesFlexbox:YES]; - [container css_setFlexDirection:CSSFlexDirectionRow]; - [container css_setAlignItems:CSSAlignFlexStart]; + [container css_setFlexDirection:YGFlexDirectionRow]; + [container css_setAlignItems:YGAlignFlexStart]; UILabel *longTextLabel = [[UILabel alloc] initWithFrame:CGRectZero]; longTextLabel.text = @"This is a very very very very very very very very long piece of text."; @@ -87,7 +87,7 @@ UIView *textBadgeView = [[UIView alloc] initWithFrame:CGRectZero]; [textBadgeView css_setUsesFlexbox:YES]; - [textBadgeView css_setMargin:3.0 forEdge:CSSEdgeLeft]; + [textBadgeView css_setMargin:3.0 forEdge:YGEdgeLeft]; [textBadgeView css_setWidth:10]; [textBadgeView css_setHeight:10]; [container addSubview:textBadgeView]; @@ -102,7 +102,7 @@ UIView *container = [[UIView alloc] initWithFrame:CGRectMake(0, 0, containerSize.width, containerSize.height)]; [container css_setUsesFlexbox:YES]; - [container css_setFlexDirection:CSSFlexDirectionRow]; + [container css_setFlexDirection:YGFlexDirectionRow]; for (int i = 0; i < 3; i++) { UIView *subview = [[UIView alloc] initWithFrame:CGRectZero]; @@ -131,7 +131,7 @@ UIView *container = [[UIView alloc] initWithFrame:CGRectMake(0, 0, containerSize.width, containerSize.height)]; [container css_setUsesFlexbox:YES]; - [container css_setFlexDirection:CSSFlexDirectionRow]; + [container css_setFlexDirection:YGFlexDirectionRow]; UIView *subview1 = [[UIView alloc] initWithFrame:CGRectZero]; [subview1 css_setUsesFlexbox:YES]; @@ -171,7 +171,7 @@ UIView *container = [[UIView alloc] initWithFrame:CGRectMake(0, 0, containerSize.width, containerSize.height)]; [container css_setUsesFlexbox:YES]; - [container css_setFlexDirection:CSSFlexDirectionRow]; + [container css_setFlexDirection:YGFlexDirectionRow]; UIView *subview1 = [[UIView alloc] initWithFrame:CGRectZero]; [subview1 css_setUsesFlexbox:YES]; @@ -208,7 +208,7 @@ { UIView *container = [[UIView alloc] initWithFrame:CGRectZero]; [container css_setUsesFlexbox:YES]; - [container css_setFlexDirection:CSSFlexDirectionRow]; + [container css_setFlexDirection:YGFlexDirectionRow]; UIView *subview1 = [[UIView alloc] initWithFrame:CGRectZero]; [subview1 css_setUsesFlexbox:YES]; @@ -237,7 +237,7 @@ { UIView *container = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 300, 50)]; [container css_setUsesFlexbox:YES]; - [container css_setFlexDirection:CSSFlexDirectionRow]; + [container css_setFlexDirection:YGFlexDirectionRow]; UIView *subview1 = [[UIView alloc] initWithFrame:CGRectZero]; [subview1 css_setUsesFlexbox:YES]; diff --git a/CSSLayoutKit/UIView+CSSLayout.h b/CSSLayoutKit/UIView+CSSLayout.h index 6938fd95..c88fbfbb 100644 --- a/CSSLayoutKit/UIView+CSSLayout.h +++ b/CSSLayoutKit/UIView+CSSLayout.h @@ -22,22 +22,22 @@ */ @property (nonatomic, readwrite, assign, setter=css_setUsesFlexbox:) BOOL css_usesFlexbox; -- (void)css_setDirection:(CSSDirection)direction; -- (void)css_setFlexDirection:(CSSFlexDirection)flexDirection; -- (void)css_setJustifyContent:(CSSJustify)justifyContent; -- (void)css_setAlignContent:(CSSAlign)alignContent; -- (void)css_setAlignItems:(CSSAlign)alignItems; -- (void)css_setAlignSelf:(CSSAlign)alignSelf; -- (void)css_setPositionType:(CSSPositionType)positionType; -- (void)css_setFlexWrap:(CSSWrap)flexWrap; +- (void)css_setDirection:(YGDirection)direction; +- (void)css_setFlexDirection:(YGFlexDirection)flexDirection; +- (void)css_setJustifyContent:(YGJustify)justifyContent; +- (void)css_setAlignContent:(YGAlign)alignContent; +- (void)css_setAlignItems:(YGAlign)alignItems; +- (void)css_setAlignSelf:(YGAlign)alignSelf; +- (void)css_setPositionType:(YGPositionType)positionType; +- (void)css_setFlexWrap:(YGWrap)flexWrap; - (void)css_setFlexGrow:(CGFloat)flexGrow; - (void)css_setFlexShrink:(CGFloat)flexShrink; - (void)css_setFlexBasis:(CGFloat)flexBasis; -- (void)css_setPosition:(CGFloat)position forEdge:(CSSEdge)edge; -- (void)css_setMargin:(CGFloat)margin forEdge:(CSSEdge)edge; -- (void)css_setPadding:(CGFloat)padding forEdge:(CSSEdge)edge; +- (void)css_setPosition:(CGFloat)position forEdge:(YGEdge)edge; +- (void)css_setMargin:(CGFloat)margin forEdge:(YGEdge)edge; +- (void)css_setPadding:(CGFloat)padding forEdge:(YGEdge)edge; - (void)css_setWidth:(CGFloat)width; - (void)css_setHeight:(CGFloat)height; @@ -50,9 +50,9 @@ - (void)css_setAspectRatio:(CGFloat)aspectRatio; /** - Get the resolved direction of this node. This won't be CSSDirectionInherit + Get the resolved direction of this node. This won't be YGDirectionInherit */ -- (CSSDirection)css_resolvedDirection; +- (YGDirection)css_resolvedDirection; /** Perform a layout calculation and update the frames of the views in the hierarchy with th results diff --git a/CSSLayoutKit/UIView+CSSLayout.m b/CSSLayoutKit/UIView+CSSLayout.m index 664f50fb..21b4010a 100644 --- a/CSSLayoutKit/UIView+CSSLayout.m +++ b/CSSLayoutKit/UIView+CSSLayout.m @@ -19,7 +19,7 @@ + (void)initialize { - CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureWebFlexBasis, true); + CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureWebFlexBasis, true); } - (instancetype)init @@ -76,42 +76,42 @@ OBJC_ASSOCIATION_RETAIN_NONATOMIC); } -- (void)css_setDirection:(CSSDirection)direction +- (void)css_setDirection:(YGDirection)direction { CSSNodeStyleSetDirection([self cssNode], direction); } -- (void)css_setFlexDirection:(CSSFlexDirection)flexDirection +- (void)css_setFlexDirection:(YGFlexDirection)flexDirection { CSSNodeStyleSetFlexDirection([self cssNode], flexDirection); } -- (void)css_setJustifyContent:(CSSJustify)justifyContent +- (void)css_setJustifyContent:(YGJustify)justifyContent { CSSNodeStyleSetJustifyContent([self cssNode], justifyContent); } -- (void)css_setAlignContent:(CSSAlign)alignContent +- (void)css_setAlignContent:(YGAlign)alignContent { CSSNodeStyleSetAlignContent([self cssNode], alignContent); } -- (void)css_setAlignItems:(CSSAlign)alignItems +- (void)css_setAlignItems:(YGAlign)alignItems { CSSNodeStyleSetAlignItems([self cssNode], alignItems); } -- (void)css_setAlignSelf:(CSSAlign)alignSelf +- (void)css_setAlignSelf:(YGAlign)alignSelf { CSSNodeStyleSetAlignSelf([self cssNode], alignSelf); } -- (void)css_setPositionType:(CSSPositionType)positionType +- (void)css_setPositionType:(YGPositionType)positionType { CSSNodeStyleSetPositionType([self cssNode], positionType); } -- (void)css_setFlexWrap:(CSSWrap)flexWrap +- (void)css_setFlexWrap:(YGWrap)flexWrap { CSSNodeStyleSetFlexWrap([self cssNode], flexWrap); } @@ -131,17 +131,17 @@ CSSNodeStyleSetFlexBasis([self cssNode], flexBasis); } -- (void)css_setPosition:(CGFloat)position forEdge:(CSSEdge)edge +- (void)css_setPosition:(CGFloat)position forEdge:(YGEdge)edge { CSSNodeStyleSetPosition([self cssNode], edge, position); } -- (void)css_setMargin:(CGFloat)margin forEdge:(CSSEdge)edge +- (void)css_setMargin:(CGFloat)margin forEdge:(YGEdge)edge { CSSNodeStyleSetMargin([self cssNode], edge, margin); } -- (void)css_setPadding:(CGFloat)padding forEdge:(CSSEdge)edge +- (void)css_setPadding:(CGFloat)padding forEdge:(YGEdge)edge { CSSNodeStyleSetPadding([self cssNode], edge, padding); } @@ -183,7 +183,7 @@ #pragma mark - Layout and Sizing -- (CSSDirection)css_resolvedDirection +- (YGDirection)css_resolvedDirection { return CSSNodeLayoutGetDirection([self cssNode]); } @@ -197,8 +197,8 @@ - (CGSize)css_intrinsicSize { const CGSize constrainedSize = { - .width = CSSUndefined, - .height = CSSUndefined, + .width = YGUndefined, + .height = YGUndefined, }; return [self calculateLayoutWithSize:constrainedSize]; } @@ -240,12 +240,12 @@ static CSSSize CSSMeasureView( CSSNodeRef node, float width, - CSSMeasureMode widthMode, + YGMeasureMode widthMode, float height, - CSSMeasureMode heightMode) + YGMeasureMode heightMode) { - const CGFloat constrainedWidth = (widthMode == CSSMeasureModeUndefined) ? CGFLOAT_MAX : width; - const CGFloat constrainedHeight = (heightMode == CSSMeasureModeUndefined) ? CGFLOAT_MAX: height; + const CGFloat constrainedWidth = (widthMode == YGMeasureModeUndefined) ? CGFLOAT_MAX : width; + const CGFloat constrainedHeight = (heightMode == YGMeasureModeUndefined) ? CGFLOAT_MAX: height; UIView *view = (__bridge UIView*) CSSNodeGetContext(node); const CGSize sizeThatFits = [view sizeThatFits:(CGSize) { @@ -262,12 +262,12 @@ static CSSSize CSSMeasureView( static CGFloat CSSSanitizeMeasurement( CGFloat constrainedSize, CGFloat measuredSize, - CSSMeasureMode measureMode) + YGMeasureMode measureMode) { CGFloat result; - if (measureMode == CSSMeasureModeExactly) { + if (measureMode == YGMeasureModeExactly) { result = constrainedSize; - } else if (measureMode == CSSMeasureModeAtMost) { + } else if (measureMode == YGMeasureModeAtMost) { result = MIN(constrainedSize, measuredSize); } else { result = measuredSize; diff --git a/README.md b/README.md index ea044d33..c6bd9f37 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ for (uint32_t i = 0; i < 10; i++) { CSSNodeInsertChild(root, child, 0); } -CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); +CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); // Get for resulting layout CSSNodeLayoutGetLeft(root); diff --git a/benchmark/CSSBenchmark.c b/benchmark/CSSBenchmark.c index 0bab9511..79499f29 100644 --- a/benchmark/CSSBenchmark.c +++ b/benchmark/CSSBenchmark.c @@ -13,12 +13,12 @@ static CSSSize _measure(CSSNodeRef node, float width, - CSSMeasureMode widthMode, + YGMeasureMode widthMode, float height, - CSSMeasureMode heightMode) { + YGMeasureMode heightMode) { return (CSSSize){ - .width = widthMode == CSSMeasureModeUndefined ? 10 : width, - .height = heightMode == CSSMeasureModeUndefined ? 10 : width, + .width = widthMode == YGMeasureModeUndefined ? 10 : width, + .height = heightMode == YGMeasureModeUndefined ? 10 : width, }; } @@ -36,7 +36,7 @@ CSS_BENCHMARKS({ CSSNodeInsertChild(root, child, 0); } - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); CSSNodeFreeRecursive(root); }); @@ -50,7 +50,7 @@ CSS_BENCHMARKS({ CSSNodeInsertChild(root, child, 0); } - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); CSSNodeFreeRecursive(root); }); @@ -70,7 +70,7 @@ CSS_BENCHMARKS({ } } - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); CSSNodeFreeRecursive(root); }); @@ -86,7 +86,7 @@ CSS_BENCHMARKS({ for (uint32_t ii = 0; ii < 10; ii++) { const CSSNodeRef grandChild = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(grandChild, CSSFlexDirectionRow); + CSSNodeStyleSetFlexDirection(grandChild, YGFlexDirectionRow); CSSNodeStyleSetFlexGrow(grandChild, 1); CSSNodeStyleSetWidth(grandChild, 10); CSSNodeStyleSetHeight(grandChild, 10); @@ -101,7 +101,7 @@ CSS_BENCHMARKS({ for (uint32_t iii = 0; iii < 10; iii++) { const CSSNodeRef grandGrandGrandChild = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(grandGrandGrandChild, CSSFlexDirectionRow); + CSSNodeStyleSetFlexDirection(grandGrandGrandChild, YGFlexDirectionRow); CSSNodeStyleSetFlexGrow(grandGrandGrandChild, 1); CSSNodeStyleSetWidth(grandGrandGrandChild, 10); CSSNodeStyleSetHeight(grandGrandGrandChild, 10); @@ -111,7 +111,7 @@ CSS_BENCHMARKS({ } } - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); CSSNodeFreeRecursive(root); }); diff --git a/csharp/CSSLayout/CSSInterop.cpp b/csharp/CSSLayout/CSSInterop.cpp index 679d6544..7995cab2 100644 --- a/csharp/CSSLayout/CSSInterop.cpp +++ b/csharp/CSSLayout/CSSInterop.cpp @@ -11,7 +11,7 @@ static CSSInteropLoggerFunc gManagedFunc; -static int unmanagedLogger(CSSLogLevel level, const char *format, va_list args) { +static int unmanagedLogger(YGLogLevel level, const char *format, va_list args) { int result = 0; if (gManagedFunc) { char buffer[256]; diff --git a/csharp/CSSLayout/CSSInterop.h b/csharp/CSSLayout/CSSInterop.h index bbff6072..daa82247 100644 --- a/csharp/CSSLayout/CSSInterop.h +++ b/csharp/CSSLayout/CSSInterop.h @@ -13,7 +13,7 @@ CSS_EXTERN_C_BEGIN -typedef void (*CSSInteropLoggerFunc)(CSSLogLevel level, const char *message); +typedef void (*CSSInteropLoggerFunc)(YGLogLevel level, const char *message); WIN_EXPORT void CSSInteropSetLogger(CSSInteropLoggerFunc managedFunc); diff --git a/csharp/Facebook.CSSLayout/CSSDIrection.cs b/csharp/Facebook.CSSLayout/CSSDIrection.cs deleted file mode 100644 index f350e288..00000000 --- a/csharp/Facebook.CSSLayout/CSSDIrection.cs +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright (c) 2014-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -namespace Facebook.CSSLayout -{ - public enum CSSDirection - { - Inherit, - LTR, - RTL, - [System.Obsolete("Use LTR instead")] - LeftToRight = LTR, - [System.Obsolete("Use RTL instead")] - RightToLeft = RTL, - } -} diff --git a/csharp/Facebook.CSSLayout/CSSLogger.cs b/csharp/Facebook.CSSLayout/CSSLogger.cs index 60122f27..16718deb 100644 --- a/csharp/Facebook.CSSLayout/CSSLogger.cs +++ b/csharp/Facebook.CSSLayout/CSSLogger.cs @@ -15,7 +15,7 @@ namespace Facebook.CSSLayout internal static class CSSLogger { [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate void Func(CSSLogLevel level, string message); + public delegate void Func(YogaLogLevel level, string message); private static bool _initialized; private static Func _managedLogger = null; @@ -32,7 +32,7 @@ namespace Facebook.CSSLayout Logger(level, message); } - if (level == CSSLogLevel.Error) + if (level == YogaLogLevel.Error) { throw new InvalidOperationException(message); } diff --git a/csharp/Facebook.CSSLayout/CSSMeasureFunc.cs b/csharp/Facebook.CSSLayout/CSSMeasureFunc.cs index cd5744d5..6864c280 100644 --- a/csharp/Facebook.CSSLayout/CSSMeasureFunc.cs +++ b/csharp/Facebook.CSSLayout/CSSMeasureFunc.cs @@ -14,9 +14,9 @@ namespace Facebook.CSSLayout { [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate CSSSize CSSMeasureFunc( - IntPtr node, + IntPtr node, float width, - CSSMeasureMode widthMode, + YogaMeasureMode widthMode, float height, - CSSMeasureMode heightMode); + YogaMeasureMode heightMode); } diff --git a/csharp/Facebook.CSSLayout/CSSNode.Create.cs b/csharp/Facebook.CSSLayout/CSSNode.Create.cs index ff301b8d..31a52c85 100644 --- a/csharp/Facebook.CSSLayout/CSSNode.Create.cs +++ b/csharp/Facebook.CSSLayout/CSSNode.Create.cs @@ -14,15 +14,15 @@ namespace Facebook.CSSLayout public partial class CSSNode { public static CSSNode Create( - CSSDirection? styleDirection = null, - CSSFlexDirection? flexDirection = null, - CSSJustify? justifyContent = null, - CSSAlign? alignContent = null, - CSSAlign? alignItems = null, - CSSAlign? alignSelf = null, - CSSPositionType? positionType = null, - CSSWrap? wrap = null, - CSSOverflow? overflow = null, + YogaDirection? styleDirection = null, + YogaFlexDirection? flexDirection = null, + YogaJustify? justifyContent = null, + YogaAlign? alignContent = null, + YogaAlign? alignItems = null, + YogaAlign? alignSelf = null, + YogaPositionType? positionType = null, + YogaWrap? wrap = null, + YogaOverflow? overflow = null, float? flex = null, float? flexGrow = null, float? flexShrink = null, @@ -110,22 +110,22 @@ namespace Facebook.CSSLayout { if (position.Top.HasValue) { - node.SetPosition(CSSEdge.Top, position.Top.Value); + node.SetPosition(YogaEdge.Top, position.Top.Value); } if (position.Bottom.HasValue) { - node.SetPosition(CSSEdge.Bottom, position.Bottom.Value); + node.SetPosition(YogaEdge.Bottom, position.Bottom.Value); } if (position.Left.HasValue) { - node.SetPosition(CSSEdge.Left, position.Left.Value); + node.SetPosition(YogaEdge.Left, position.Left.Value); } if (position.Right.HasValue) { - node.SetPosition(CSSEdge.Right, position.Right.Value); + node.SetPosition(YogaEdge.Right, position.Right.Value); } } @@ -133,22 +133,22 @@ namespace Facebook.CSSLayout { if (margin.Top.HasValue) { - node.SetMargin(CSSEdge.Top, margin.Top.Value); + node.SetMargin(YogaEdge.Top, margin.Top.Value); } if (margin.Bottom.HasValue) { - node.SetMargin(CSSEdge.Bottom, margin.Bottom.Value); + node.SetMargin(YogaEdge.Bottom, margin.Bottom.Value); } if (margin.Left.HasValue) { - node.SetMargin(CSSEdge.Left, margin.Left.Value); + node.SetMargin(YogaEdge.Left, margin.Left.Value); } if (margin.Right.HasValue) { - node.SetMargin(CSSEdge.Right, margin.Right.Value); + node.SetMargin(YogaEdge.Right, margin.Right.Value); } } @@ -156,22 +156,22 @@ namespace Facebook.CSSLayout { if (padding.Top.HasValue) { - node.SetPadding(CSSEdge.Top, padding.Top.Value); + node.SetPadding(YogaEdge.Top, padding.Top.Value); } if (padding.Bottom.HasValue) { - node.SetPadding(CSSEdge.Bottom, padding.Bottom.Value); + node.SetPadding(YogaEdge.Bottom, padding.Bottom.Value); } if (padding.Left.HasValue) { - node.SetPadding(CSSEdge.Left, padding.Left.Value); + node.SetPadding(YogaEdge.Left, padding.Left.Value); } if (padding.Right.HasValue) { - node.SetPadding(CSSEdge.Right, padding.Right.Value); + node.SetPadding(YogaEdge.Right, padding.Right.Value); } } @@ -179,22 +179,22 @@ namespace Facebook.CSSLayout { if (border.Top.HasValue) { - node.SetBorder(CSSEdge.Top, border.Top.Value); + node.SetBorder(YogaEdge.Top, border.Top.Value); } if (border.Bottom.HasValue) { - node.SetBorder(CSSEdge.Bottom, border.Bottom.Value); + node.SetBorder(YogaEdge.Bottom, border.Bottom.Value); } if (border.Left.HasValue) { - node.SetBorder(CSSEdge.Left, border.Left.Value); + node.SetBorder(YogaEdge.Left, border.Left.Value); } if (border.Right.HasValue) { - node.SetBorder(CSSEdge.Right, border.Right.Value); + node.SetBorder(YogaEdge.Right, border.Right.Value); } } diff --git a/csharp/Facebook.CSSLayout/CSSNode.cs b/csharp/Facebook.CSSLayout/CSSNode.cs index 0583a823..73694f6f 100644 --- a/csharp/Facebook.CSSLayout/CSSNode.cs +++ b/csharp/Facebook.CSSLayout/CSSNode.cs @@ -95,7 +95,7 @@ namespace Facebook.CSSLayout Native.CSSNodeCopyStyle(_cssNode, srcNode._cssNode); } - public CSSDirection StyleDirection + public YogaDirection StyleDirection { get { @@ -108,7 +108,7 @@ namespace Facebook.CSSLayout } } - public CSSFlexDirection FlexDirection + public YogaFlexDirection FlexDirection { get { @@ -121,7 +121,7 @@ namespace Facebook.CSSLayout } } - public CSSJustify JustifyContent + public YogaJustify JustifyContent { get { @@ -134,7 +134,7 @@ namespace Facebook.CSSLayout } } - public CSSAlign AlignItems + public YogaAlign AlignItems { get { @@ -147,7 +147,7 @@ namespace Facebook.CSSLayout } } - public CSSAlign AlignSelf + public YogaAlign AlignSelf { get { @@ -160,7 +160,7 @@ namespace Facebook.CSSLayout } } - public CSSAlign AlignContent + public YogaAlign AlignContent { get { @@ -173,7 +173,7 @@ namespace Facebook.CSSLayout } } - public CSSPositionType PositionType + public YogaPositionType PositionType { get { @@ -186,7 +186,7 @@ namespace Facebook.CSSLayout } } - public CSSWrap Wrap + public YogaWrap Wrap { get { @@ -246,42 +246,42 @@ namespace Facebook.CSSLayout } } - public float GetMargin(CSSEdge edge) + public float GetMargin(YogaEdge edge) { return Native.CSSNodeStyleGetMargin(_cssNode, edge); } - public void SetMargin(CSSEdge edge, float value) + public void SetMargin(YogaEdge edge, float value) { Native.CSSNodeStyleSetMargin(_cssNode, edge, value); } - public float GetPadding(CSSEdge edge) + public float GetPadding(YogaEdge edge) { return Native.CSSNodeStyleGetPadding(_cssNode, edge); } - public void SetPadding(CSSEdge edge, float padding) + public void SetPadding(YogaEdge edge, float padding) { Native.CSSNodeStyleSetPadding(_cssNode, edge, padding); } - public float GetBorder(CSSEdge edge) + public float GetBorder(YogaEdge edge) { return Native.CSSNodeStyleGetBorder(_cssNode, edge); } - public void SetBorder(CSSEdge edge, float border) + public void SetBorder(YogaEdge edge, float border) { Native.CSSNodeStyleSetBorder(_cssNode, edge, border); } - public float GetPosition(CSSEdge edge) + public float GetPosition(YogaEdge edge) { return Native.CSSNodeStyleGetPosition(_cssNode, edge); } - public void SetPosition(CSSEdge edge, float position) + public void SetPosition(YogaEdge edge, float position) { Native.CSSNodeStyleSetPosition(_cssNode, edge, position); } @@ -409,7 +409,7 @@ namespace Facebook.CSSLayout } } - public CSSDirection LayoutDirection + public YogaDirection LayoutDirection { get { @@ -417,7 +417,7 @@ namespace Facebook.CSSLayout } } - public CSSOverflow Overflow + public YogaOverflow Overflow { get { @@ -520,17 +520,17 @@ namespace Facebook.CSSLayout { Native.CSSNodeCalculateLayout( _cssNode, - CSSConstants.Undefined, - CSSConstants.Undefined, + YogaConstants.Undefined, + YogaConstants.Undefined, Native.CSSNodeStyleGetDirection(_cssNode)); } private CSSSize MeasureInternal( IntPtr node, float width, - CSSMeasureMode widthMode, + YogaMeasureMode widthMode, float height, - CSSMeasureMode heightMode) + YogaMeasureMode heightMode) { if (_measureFunction == null) { @@ -541,8 +541,8 @@ namespace Facebook.CSSLayout return new CSSSize { width = MeasureOutput.GetWidth(output), height = MeasureOutput.GetHeight(output) }; } - public string Print(CSSPrintOptions options = - CSSPrintOptions.Layout|CSSPrintOptions.Style|CSSPrintOptions.Children) + public string Print(YogaPrintOptions options = + YogaPrintOptions.Layout|YogaPrintOptions.Style|YogaPrintOptions.Children) { StringBuilder sb = new StringBuilder(); CSSLogger.Func orig = CSSLogger.Logger; @@ -570,13 +570,13 @@ namespace Facebook.CSSLayout } public static void SetExperimentalFeatureEnabled( - CSSExperimentalFeature feature, + YogaExperimentalFeature feature, bool enabled) { Native.CSSLayoutSetExperimentalFeatureEnabled(feature, enabled); } - public static bool IsExperimentalFeatureEnabled(CSSExperimentalFeature feature) + public static bool IsExperimentalFeatureEnabled(YogaExperimentalFeature feature) { return Native.CSSLayoutIsExperimentalFeatureEnabled(feature); } diff --git a/csharp/Facebook.CSSLayout/MeasureFunction.cs b/csharp/Facebook.CSSLayout/MeasureFunction.cs index 51614e17..3c8128e0 100644 --- a/csharp/Facebook.CSSLayout/MeasureFunction.cs +++ b/csharp/Facebook.CSSLayout/MeasureFunction.cs @@ -12,7 +12,7 @@ namespace Facebook.CSSLayout public delegate long MeasureFunction( CSSNode node, float width, - CSSMeasureMode widthMode, + YogaMeasureMode widthMode, float height, - CSSMeasureMode heightMode); + YogaMeasureMode heightMode); } diff --git a/csharp/Facebook.CSSLayout/Native.cs b/csharp/Facebook.CSSLayout/Native.cs index 682b8fdd..7e910732 100644 --- a/csharp/Facebook.CSSLayout/Native.cs +++ b/csharp/Facebook.CSSLayout/Native.cs @@ -41,12 +41,12 @@ namespace Facebook.CSSLayout [DllImport(DllName)] public static extern void CSSLayoutSetExperimentalFeatureEnabled( - CSSExperimentalFeature feature, + YogaExperimentalFeature feature, bool enabled); [DllImport(DllName)] public static extern bool CSSLayoutIsExperimentalFeatureEnabled( - CSSExperimentalFeature feature); + YogaExperimentalFeature feature); [DllImport(DllName)] public static extern void CSSNodeInsertChild(IntPtr node, IntPtr child, uint index); @@ -64,7 +64,7 @@ namespace Facebook.CSSLayout public static extern void CSSNodeCalculateLayout(IntPtr node, float availableWidth, float availableHeight, - CSSDirection parentDirection); + YogaDirection parentDirection); [DllImport(DllName)] public static extern void CSSNodeMarkDirty(IntPtr node); @@ -74,7 +74,7 @@ namespace Facebook.CSSLayout public static extern bool CSSNodeIsDirty(IntPtr node); [DllImport(DllName)] - public static extern void CSSNodePrint(IntPtr node, CSSPrintOptions options); + public static extern void CSSNodePrint(IntPtr node, YogaPrintOptions options); [DllImport(DllName)] [return: MarshalAs(UnmanagedType.I1)] @@ -112,58 +112,58 @@ namespace Facebook.CSSLayout #region CSS_NODE_STYLE_PROPERTY [DllImport(DllName)] - public static extern void CSSNodeStyleSetDirection(IntPtr node, CSSDirection direction); + public static extern void CSSNodeStyleSetDirection(IntPtr node, YogaDirection direction); [DllImport(DllName)] - public static extern CSSDirection CSSNodeStyleGetDirection(IntPtr node); + public static extern YogaDirection CSSNodeStyleGetDirection(IntPtr node); [DllImport(DllName)] - public static extern void CSSNodeStyleSetFlexDirection(IntPtr node, CSSFlexDirection flexDirection); + public static extern void CSSNodeStyleSetFlexDirection(IntPtr node, YogaFlexDirection flexDirection); [DllImport(DllName)] - public static extern CSSFlexDirection CSSNodeStyleGetFlexDirection(IntPtr node); + public static extern YogaFlexDirection CSSNodeStyleGetFlexDirection(IntPtr node); [DllImport(DllName)] - public static extern void CSSNodeStyleSetJustifyContent(IntPtr node, CSSJustify justifyContent); + public static extern void CSSNodeStyleSetJustifyContent(IntPtr node, YogaJustify justifyContent); [DllImport(DllName)] - public static extern CSSJustify CSSNodeStyleGetJustifyContent(IntPtr node); + public static extern YogaJustify CSSNodeStyleGetJustifyContent(IntPtr node); [DllImport(DllName)] - public static extern void CSSNodeStyleSetAlignContent(IntPtr node, CSSAlign alignContent); + public static extern void CSSNodeStyleSetAlignContent(IntPtr node, YogaAlign alignContent); [DllImport(DllName)] - public static extern CSSAlign CSSNodeStyleGetAlignContent(IntPtr node); + public static extern YogaAlign CSSNodeStyleGetAlignContent(IntPtr node); [DllImport(DllName)] - public static extern void CSSNodeStyleSetAlignItems(IntPtr node, CSSAlign alignItems); + public static extern void CSSNodeStyleSetAlignItems(IntPtr node, YogaAlign alignItems); [DllImport(DllName)] - public static extern CSSAlign CSSNodeStyleGetAlignItems(IntPtr node); + public static extern YogaAlign CSSNodeStyleGetAlignItems(IntPtr node); [DllImport(DllName)] - public static extern void CSSNodeStyleSetAlignSelf(IntPtr node, CSSAlign alignSelf); + public static extern void CSSNodeStyleSetAlignSelf(IntPtr node, YogaAlign alignSelf); [DllImport(DllName)] - public static extern CSSAlign CSSNodeStyleGetAlignSelf(IntPtr node); + public static extern YogaAlign CSSNodeStyleGetAlignSelf(IntPtr node); [DllImport(DllName)] - public static extern void CSSNodeStyleSetPositionType(IntPtr node, CSSPositionType positionType); + public static extern void CSSNodeStyleSetPositionType(IntPtr node, YogaPositionType positionType); [DllImport(DllName)] - public static extern CSSPositionType CSSNodeStyleGetPositionType(IntPtr node); + public static extern YogaPositionType CSSNodeStyleGetPositionType(IntPtr node); [DllImport(DllName)] - public static extern void CSSNodeStyleSetFlexWrap(IntPtr node, CSSWrap flexWrap); + public static extern void CSSNodeStyleSetFlexWrap(IntPtr node, YogaWrap flexWrap); [DllImport(DllName)] - public static extern CSSWrap CSSNodeStyleGetFlexWrap(IntPtr node); + public static extern YogaWrap CSSNodeStyleGetFlexWrap(IntPtr node); [DllImport(DllName)] - public static extern void CSSNodeStyleSetOverflow(IntPtr node, CSSOverflow flexWrap); + public static extern void CSSNodeStyleSetOverflow(IntPtr node, YogaOverflow flexWrap); [DllImport(DllName)] - public static extern CSSOverflow CSSNodeStyleGetOverflow(IntPtr node); + public static extern YogaOverflow CSSNodeStyleGetOverflow(IntPtr node); [DllImport(DllName)] public static extern void CSSNodeStyleSetFlex(IntPtr node, float flex); @@ -233,28 +233,28 @@ namespace Facebook.CSSLayout #region CSS_NODE_STYLE_EDGE_PROPERTY [DllImport(DllName)] - public static extern void CSSNodeStyleSetPosition(IntPtr node, CSSEdge edge, float position); + public static extern void CSSNodeStyleSetPosition(IntPtr node, YogaEdge edge, float position); [DllImport(DllName)] - public static extern float CSSNodeStyleGetPosition(IntPtr node, CSSEdge edge); + public static extern float CSSNodeStyleGetPosition(IntPtr node, YogaEdge edge); [DllImport(DllName)] - public static extern void CSSNodeStyleSetMargin(IntPtr node, CSSEdge edge, float margin); + public static extern void CSSNodeStyleSetMargin(IntPtr node, YogaEdge edge, float margin); [DllImport(DllName)] - public static extern float CSSNodeStyleGetMargin(IntPtr node, CSSEdge edge); + public static extern float CSSNodeStyleGetMargin(IntPtr node, YogaEdge edge); [DllImport(DllName)] - public static extern void CSSNodeStyleSetPadding(IntPtr node, CSSEdge edge, float padding); + public static extern void CSSNodeStyleSetPadding(IntPtr node, YogaEdge edge, float padding); [DllImport(DllName)] - public static extern float CSSNodeStyleGetPadding(IntPtr node, CSSEdge edge); + public static extern float CSSNodeStyleGetPadding(IntPtr node, YogaEdge edge); [DllImport(DllName)] - public static extern void CSSNodeStyleSetBorder(IntPtr node, CSSEdge edge, float border); + public static extern void CSSNodeStyleSetBorder(IntPtr node, YogaEdge edge, float border); [DllImport(DllName)] - public static extern float CSSNodeStyleGetBorder(IntPtr node, CSSEdge edge); + public static extern float CSSNodeStyleGetBorder(IntPtr node, YogaEdge edge); #endregion @@ -279,7 +279,7 @@ namespace Facebook.CSSLayout public static extern float CSSNodeLayoutGetHeight(IntPtr node); [DllImport(DllName)] - public static extern CSSDirection CSSNodeLayoutGetDirection(IntPtr node); + public static extern YogaDirection CSSNodeLayoutGetDirection(IntPtr node); #endregion } diff --git a/csharp/Facebook.CSSLayout/CSSAlign.cs b/csharp/Facebook.CSSLayout/YogaAlign.cs similarity index 94% rename from csharp/Facebook.CSSLayout/CSSAlign.cs rename to csharp/Facebook.CSSLayout/YogaAlign.cs index 94cbad3b..64932253 100644 --- a/csharp/Facebook.CSSLayout/CSSAlign.cs +++ b/csharp/Facebook.CSSLayout/YogaAlign.cs @@ -9,7 +9,7 @@ namespace Facebook.CSSLayout { - public enum CSSAlign + public enum YogaAlign { Auto, FlexStart, diff --git a/csharp/Facebook.CSSLayout/CSSConstants.cs b/csharp/Facebook.CSSLayout/YogaConstants.cs similarity index 93% rename from csharp/Facebook.CSSLayout/CSSConstants.cs rename to csharp/Facebook.CSSLayout/YogaConstants.cs index a57d62f2..b7fa3399 100644 --- a/csharp/Facebook.CSSLayout/CSSConstants.cs +++ b/csharp/Facebook.CSSLayout/YogaConstants.cs @@ -9,7 +9,7 @@ namespace Facebook.CSSLayout { - public static class CSSConstants + public static class YogaConstants { public const float Undefined = float.NaN; diff --git a/csharp/Facebook.CSSLayout/CSSDimension.cs b/csharp/Facebook.CSSLayout/YogaDimension.cs similarity index 92% rename from csharp/Facebook.CSSLayout/CSSDimension.cs rename to csharp/Facebook.CSSLayout/YogaDimension.cs index 9ae6512f..dd167359 100644 --- a/csharp/Facebook.CSSLayout/CSSDimension.cs +++ b/csharp/Facebook.CSSLayout/YogaDimension.cs @@ -9,7 +9,7 @@ namespace Facebook.CSSLayout { - public enum CSSDimension + public enum YogaDimension { Width, Height, diff --git a/csharp/Facebook.CSSLayout/YogaDirection.cs b/csharp/Facebook.CSSLayout/YogaDirection.cs new file mode 100644 index 00000000..4f1317b6 --- /dev/null +++ b/csharp/Facebook.CSSLayout/YogaDirection.cs @@ -0,0 +1,18 @@ +/** + * Copyright (c) 2014-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +namespace Facebook.CSSLayout +{ + public enum YogaDirection + { + Inherit, + LTR, + RTL, + } +} diff --git a/csharp/Facebook.CSSLayout/CSSEdge.cs b/csharp/Facebook.CSSLayout/YogaEdge.cs similarity index 95% rename from csharp/Facebook.CSSLayout/CSSEdge.cs rename to csharp/Facebook.CSSLayout/YogaEdge.cs index b639eb9e..15a7ef75 100644 --- a/csharp/Facebook.CSSLayout/CSSEdge.cs +++ b/csharp/Facebook.CSSLayout/YogaEdge.cs @@ -9,7 +9,7 @@ namespace Facebook.CSSLayout { - public enum CSSEdge + public enum YogaEdge { Left, Top, diff --git a/csharp/Facebook.CSSLayout/CSSExperimentalFeature.cs b/csharp/Facebook.CSSLayout/YogaExperimentalFeature.cs similarity index 90% rename from csharp/Facebook.CSSLayout/CSSExperimentalFeature.cs rename to csharp/Facebook.CSSLayout/YogaExperimentalFeature.cs index 160fc724..b5b09f3a 100644 --- a/csharp/Facebook.CSSLayout/CSSExperimentalFeature.cs +++ b/csharp/Facebook.CSSLayout/YogaExperimentalFeature.cs @@ -9,7 +9,7 @@ namespace Facebook.CSSLayout { - public enum CSSExperimentalFeature + public enum YogaExperimentalFeature { Rounding, WebFlexBasis, diff --git a/csharp/Facebook.CSSLayout/CSSFlexDirection.cs b/csharp/Facebook.CSSLayout/YogaFlexDirection.cs similarity index 92% rename from csharp/Facebook.CSSLayout/CSSFlexDirection.cs rename to csharp/Facebook.CSSLayout/YogaFlexDirection.cs index 24c82392..d02eeaa9 100644 --- a/csharp/Facebook.CSSLayout/CSSFlexDirection.cs +++ b/csharp/Facebook.CSSLayout/YogaFlexDirection.cs @@ -9,7 +9,7 @@ namespace Facebook.CSSLayout { - public enum CSSFlexDirection + public enum YogaFlexDirection { Column, ColumnReverse, diff --git a/csharp/Facebook.CSSLayout/CSSJustify.cs b/csharp/Facebook.CSSLayout/YogaJustify.cs similarity index 94% rename from csharp/Facebook.CSSLayout/CSSJustify.cs rename to csharp/Facebook.CSSLayout/YogaJustify.cs index 5f97f31b..a8a3d3a1 100644 --- a/csharp/Facebook.CSSLayout/CSSJustify.cs +++ b/csharp/Facebook.CSSLayout/YogaJustify.cs @@ -9,7 +9,7 @@ namespace Facebook.CSSLayout { - public enum CSSJustify + public enum YogaJustify { FlexStart, Center, diff --git a/csharp/Facebook.CSSLayout/CSSLogLevel.cs b/csharp/Facebook.CSSLayout/YogaLogLevel.cs similarity index 93% rename from csharp/Facebook.CSSLayout/CSSLogLevel.cs rename to csharp/Facebook.CSSLayout/YogaLogLevel.cs index 53a5cbe8..89fce541 100644 --- a/csharp/Facebook.CSSLayout/CSSLogLevel.cs +++ b/csharp/Facebook.CSSLayout/YogaLogLevel.cs @@ -9,7 +9,7 @@ namespace Facebook.CSSLayout { - public enum CSSLogLevel + public enum YogaLogLevel { Error, Warn, diff --git a/csharp/Facebook.CSSLayout/CSSMeasureMode.cs b/csharp/Facebook.CSSLayout/YogaMeasureMode.cs similarity index 92% rename from csharp/Facebook.CSSLayout/CSSMeasureMode.cs rename to csharp/Facebook.CSSLayout/YogaMeasureMode.cs index 4b9cdd9c..28d837f3 100644 --- a/csharp/Facebook.CSSLayout/CSSMeasureMode.cs +++ b/csharp/Facebook.CSSLayout/YogaMeasureMode.cs @@ -9,7 +9,7 @@ namespace Facebook.CSSLayout { - public enum CSSMeasureMode + public enum YogaMeasureMode { Undefined, Exactly, diff --git a/csharp/Facebook.CSSLayout/CSSOverflow.cs b/csharp/Facebook.CSSLayout/YogaOverflow.cs similarity index 93% rename from csharp/Facebook.CSSLayout/CSSOverflow.cs rename to csharp/Facebook.CSSLayout/YogaOverflow.cs index 7207668d..89bef500 100644 --- a/csharp/Facebook.CSSLayout/CSSOverflow.cs +++ b/csharp/Facebook.CSSLayout/YogaOverflow.cs @@ -9,7 +9,7 @@ namespace Facebook.CSSLayout { - public enum CSSOverflow + public enum YogaOverflow { Visible, Hidden, diff --git a/csharp/Facebook.CSSLayout/CSSPositionType.cs b/csharp/Facebook.CSSLayout/YogaPositionType.cs similarity index 92% rename from csharp/Facebook.CSSLayout/CSSPositionType.cs rename to csharp/Facebook.CSSLayout/YogaPositionType.cs index 11b9ebde..7f76b6a3 100644 --- a/csharp/Facebook.CSSLayout/CSSPositionType.cs +++ b/csharp/Facebook.CSSLayout/YogaPositionType.cs @@ -9,7 +9,7 @@ namespace Facebook.CSSLayout { - public enum CSSPositionType + public enum YogaPositionType { Relative, Absolute, diff --git a/csharp/Facebook.CSSLayout/CSSPrintOptions.cs b/csharp/Facebook.CSSLayout/YogaPrintOptions.cs similarity index 92% rename from csharp/Facebook.CSSLayout/CSSPrintOptions.cs rename to csharp/Facebook.CSSLayout/YogaPrintOptions.cs index 1df7d381..a52f38e8 100644 --- a/csharp/Facebook.CSSLayout/CSSPrintOptions.cs +++ b/csharp/Facebook.CSSLayout/YogaPrintOptions.cs @@ -9,7 +9,7 @@ namespace Facebook.CSSLayout { - public enum CSSPrintOptions + public enum YogaPrintOptions { Layout = 1, Style = 2, diff --git a/csharp/Facebook.CSSLayout/CSSWrap.cs b/csharp/Facebook.CSSLayout/YogaWrap.cs similarity index 93% rename from csharp/Facebook.CSSLayout/CSSWrap.cs rename to csharp/Facebook.CSSLayout/YogaWrap.cs index 34d2e4c2..df6d30bb 100644 --- a/csharp/Facebook.CSSLayout/CSSWrap.cs +++ b/csharp/Facebook.CSSLayout/YogaWrap.cs @@ -9,7 +9,7 @@ namespace Facebook.CSSLayout { - public enum CSSWrap + public enum YogaWrap { NoWrap, Wrap, diff --git a/csharp/tests/Facebook.CSSLayout/CSSLayoutAbsolutePositionTest.cs b/csharp/tests/Facebook.CSSLayout/CSSLayoutAbsolutePositionTest.cs index 0e3086d1..d058942c 100644 --- a/csharp/tests/Facebook.CSSLayout/CSSLayoutAbsolutePositionTest.cs +++ b/csharp/tests/Facebook.CSSLayout/CSSLayoutAbsolutePositionTest.cs @@ -25,13 +25,13 @@ namespace Facebook.CSSLayout root.Height = 100f; CSSNode root_child0 = new CSSNode(); - root_child0.PositionType = CSSPositionType.Absolute; - root_child0.SetPosition(CSSEdge.Start, 10f); - root_child0.SetPosition(CSSEdge.Top, 10f); + root_child0.PositionType = YogaPositionType.Absolute; + root_child0.SetPosition(YogaEdge.Start, 10f); + root_child0.SetPosition(YogaEdge.Top, 10f); root_child0.Width = 10f; root_child0.Height = 10f; root.Insert(0, root_child0); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -44,7 +44,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(10f, root_child0.LayoutWidth); Assert.AreEqual(10f, root_child0.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -66,13 +66,13 @@ namespace Facebook.CSSLayout root.Height = 100f; CSSNode root_child0 = new CSSNode(); - root_child0.PositionType = CSSPositionType.Absolute; - root_child0.SetPosition(CSSEdge.End, 10f); - root_child0.SetPosition(CSSEdge.Bottom, 10f); + root_child0.PositionType = YogaPositionType.Absolute; + root_child0.SetPosition(YogaEdge.End, 10f); + root_child0.SetPosition(YogaEdge.Bottom, 10f); root_child0.Width = 10f; root_child0.Height = 10f; root.Insert(0, root_child0); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -85,7 +85,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(10f, root_child0.LayoutWidth); Assert.AreEqual(10f, root_child0.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -107,13 +107,13 @@ namespace Facebook.CSSLayout root.Height = 100f; CSSNode root_child0 = new CSSNode(); - root_child0.PositionType = CSSPositionType.Absolute; - root_child0.SetPosition(CSSEdge.Start, 10f); - root_child0.SetPosition(CSSEdge.Top, 10f); - root_child0.SetPosition(CSSEdge.End, 10f); - root_child0.SetPosition(CSSEdge.Bottom, 10f); + root_child0.PositionType = YogaPositionType.Absolute; + root_child0.SetPosition(YogaEdge.Start, 10f); + root_child0.SetPosition(YogaEdge.Top, 10f); + root_child0.SetPosition(YogaEdge.End, 10f); + root_child0.SetPosition(YogaEdge.Bottom, 10f); root.Insert(0, root_child0); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -126,7 +126,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(80f, root_child0.LayoutWidth); Assert.AreEqual(80f, root_child0.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -148,15 +148,15 @@ namespace Facebook.CSSLayout root.Height = 100f; CSSNode root_child0 = new CSSNode(); - root_child0.PositionType = CSSPositionType.Absolute; - root_child0.SetPosition(CSSEdge.Start, 10f); - root_child0.SetPosition(CSSEdge.Top, 10f); - root_child0.SetPosition(CSSEdge.End, 10f); - root_child0.SetPosition(CSSEdge.Bottom, 10f); + root_child0.PositionType = YogaPositionType.Absolute; + root_child0.SetPosition(YogaEdge.Start, 10f); + root_child0.SetPosition(YogaEdge.Top, 10f); + root_child0.SetPosition(YogaEdge.End, 10f); + root_child0.SetPosition(YogaEdge.Bottom, 10f); root_child0.Width = 10f; root_child0.Height = 10f; root.Insert(0, root_child0); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -169,7 +169,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(10f, root_child0.LayoutWidth); Assert.AreEqual(10f, root_child0.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -187,22 +187,22 @@ namespace Facebook.CSSLayout public void Test_do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent() { CSSNode root = new CSSNode(); - root.FlexDirection = CSSFlexDirection.Row; - root.Overflow = CSSOverflow.Hidden; + root.FlexDirection = YogaFlexDirection.Row; + root.Overflow = YogaOverflow.Hidden; root.Width = 50f; root.Height = 50f; CSSNode root_child0 = new CSSNode(); - root_child0.PositionType = CSSPositionType.Absolute; - root_child0.SetPosition(CSSEdge.Start, 0f); - root_child0.SetPosition(CSSEdge.Top, 0f); + root_child0.PositionType = YogaPositionType.Absolute; + root_child0.SetPosition(YogaEdge.Start, 0f); + root_child0.SetPosition(YogaEdge.Top, 0f); root.Insert(0, root_child0); CSSNode root_child0_child0 = new CSSNode(); root_child0_child0.Width = 100f; root_child0_child0.Height = 100f; root_child0.Insert(0, root_child0_child0); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -220,7 +220,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(100f, root_child0_child0.LayoutWidth); Assert.AreEqual(100f, root_child0_child0.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -243,37 +243,37 @@ namespace Facebook.CSSLayout public void Test_absolute_layout_within_border() { CSSNode root = new CSSNode(); - root.SetMargin(CSSEdge.Left, 10f); - root.SetMargin(CSSEdge.Top, 10f); - root.SetMargin(CSSEdge.Right, 10f); - root.SetMargin(CSSEdge.Bottom, 10f); - root.SetPadding(CSSEdge.Left, 10f); - root.SetPadding(CSSEdge.Top, 10f); - root.SetPadding(CSSEdge.Right, 10f); - root.SetPadding(CSSEdge.Bottom, 10f); - root.SetBorder(CSSEdge.Left, 10f); - root.SetBorder(CSSEdge.Top, 10f); - root.SetBorder(CSSEdge.Right, 10f); - root.SetBorder(CSSEdge.Bottom, 10f); + root.SetMargin(YogaEdge.Left, 10f); + root.SetMargin(YogaEdge.Top, 10f); + root.SetMargin(YogaEdge.Right, 10f); + root.SetMargin(YogaEdge.Bottom, 10f); + root.SetPadding(YogaEdge.Left, 10f); + root.SetPadding(YogaEdge.Top, 10f); + root.SetPadding(YogaEdge.Right, 10f); + root.SetPadding(YogaEdge.Bottom, 10f); + root.SetBorder(YogaEdge.Left, 10f); + root.SetBorder(YogaEdge.Top, 10f); + root.SetBorder(YogaEdge.Right, 10f); + root.SetBorder(YogaEdge.Bottom, 10f); root.Width = 100f; root.Height = 100f; CSSNode root_child0 = new CSSNode(); - root_child0.PositionType = CSSPositionType.Absolute; - root_child0.SetPosition(CSSEdge.Left, 0f); - root_child0.SetPosition(CSSEdge.Top, 0f); + root_child0.PositionType = YogaPositionType.Absolute; + root_child0.SetPosition(YogaEdge.Left, 0f); + root_child0.SetPosition(YogaEdge.Top, 0f); root_child0.Width = 50f; root_child0.Height = 50f; root.Insert(0, root_child0); CSSNode root_child1 = new CSSNode(); - root_child1.PositionType = CSSPositionType.Absolute; - root_child1.SetPosition(CSSEdge.Right, 0f); - root_child1.SetPosition(CSSEdge.Bottom, 0f); + root_child1.PositionType = YogaPositionType.Absolute; + root_child1.SetPosition(YogaEdge.Right, 0f); + root_child1.SetPosition(YogaEdge.Bottom, 0f); root_child1.Width = 50f; root_child1.Height = 50f; root.Insert(1, root_child1); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(10f, root.LayoutX); @@ -291,7 +291,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(50f, root_child1.LayoutWidth); Assert.AreEqual(50f, root_child1.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(10f, root.LayoutX); diff --git a/csharp/tests/Facebook.CSSLayout/CSSLayoutAlignContentTest.cs b/csharp/tests/Facebook.CSSLayout/CSSLayoutAlignContentTest.cs index d2735862..c17d2b0a 100644 --- a/csharp/tests/Facebook.CSSLayout/CSSLayoutAlignContentTest.cs +++ b/csharp/tests/Facebook.CSSLayout/CSSLayoutAlignContentTest.cs @@ -21,7 +21,7 @@ namespace Facebook.CSSLayout public void Test_align_content_flex_start() { CSSNode root = new CSSNode(); - root.Wrap = CSSWrap.Wrap; + root.Wrap = YogaWrap.Wrap; root.Width = 100f; root.Height = 100f; @@ -49,7 +49,7 @@ namespace Facebook.CSSLayout root_child4.Width = 50f; root_child4.Height = 10f; root.Insert(4, root_child4); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -82,7 +82,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(50f, root_child4.LayoutWidth); Assert.AreEqual(10f, root_child4.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -120,8 +120,8 @@ namespace Facebook.CSSLayout public void Test_align_content_flex_end() { CSSNode root = new CSSNode(); - root.AlignContent = CSSAlign.FlexEnd; - root.Wrap = CSSWrap.Wrap; + root.AlignContent = YogaAlign.FlexEnd; + root.Wrap = YogaWrap.Wrap; root.Width = 100f; root.Height = 100f; @@ -149,7 +149,7 @@ namespace Facebook.CSSLayout root_child4.Width = 50f; root_child4.Height = 10f; root.Insert(4, root_child4); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -182,7 +182,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(50f, root_child4.LayoutWidth); Assert.AreEqual(10f, root_child4.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -220,8 +220,8 @@ namespace Facebook.CSSLayout public void Test_align_content_center() { CSSNode root = new CSSNode(); - root.AlignContent = CSSAlign.Center; - root.Wrap = CSSWrap.Wrap; + root.AlignContent = YogaAlign.Center; + root.Wrap = YogaWrap.Wrap; root.Width = 100f; root.Height = 100f; @@ -249,7 +249,7 @@ namespace Facebook.CSSLayout root_child4.Width = 50f; root_child4.Height = 10f; root.Insert(4, root_child4); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -282,7 +282,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(50f, root_child4.LayoutWidth); Assert.AreEqual(10f, root_child4.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -320,8 +320,8 @@ namespace Facebook.CSSLayout public void Test_align_content_stretch() { CSSNode root = new CSSNode(); - root.AlignContent = CSSAlign.Stretch; - root.Wrap = CSSWrap.Wrap; + root.AlignContent = YogaAlign.Stretch; + root.Wrap = YogaWrap.Wrap; root.Width = 100f; root.Height = 100f; @@ -344,7 +344,7 @@ namespace Facebook.CSSLayout CSSNode root_child4 = new CSSNode(); root_child4.Width = 50f; root.Insert(4, root_child4); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -377,7 +377,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(50f, root_child4.LayoutWidth); Assert.AreEqual(0f, root_child4.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); diff --git a/csharp/tests/Facebook.CSSLayout/CSSLayoutAlignItemsTest.cs b/csharp/tests/Facebook.CSSLayout/CSSLayoutAlignItemsTest.cs index e7ce8095..cf2ac0ed 100644 --- a/csharp/tests/Facebook.CSSLayout/CSSLayoutAlignItemsTest.cs +++ b/csharp/tests/Facebook.CSSLayout/CSSLayoutAlignItemsTest.cs @@ -27,7 +27,7 @@ namespace Facebook.CSSLayout CSSNode root_child0 = new CSSNode(); root_child0.Height = 10f; root.Insert(0, root_child0); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -40,7 +40,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(100f, root_child0.LayoutWidth); Assert.AreEqual(10f, root_child0.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -58,7 +58,7 @@ namespace Facebook.CSSLayout public void Test_align_items_center() { CSSNode root = new CSSNode(); - root.AlignItems = CSSAlign.Center; + root.AlignItems = YogaAlign.Center; root.Width = 100f; root.Height = 100f; @@ -66,7 +66,7 @@ namespace Facebook.CSSLayout root_child0.Width = 10f; root_child0.Height = 10f; root.Insert(0, root_child0); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -79,7 +79,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(10f, root_child0.LayoutWidth); Assert.AreEqual(10f, root_child0.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -97,7 +97,7 @@ namespace Facebook.CSSLayout public void Test_align_items_flex_start() { CSSNode root = new CSSNode(); - root.AlignItems = CSSAlign.FlexStart; + root.AlignItems = YogaAlign.FlexStart; root.Width = 100f; root.Height = 100f; @@ -105,7 +105,7 @@ namespace Facebook.CSSLayout root_child0.Width = 10f; root_child0.Height = 10f; root.Insert(0, root_child0); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -118,7 +118,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(10f, root_child0.LayoutWidth); Assert.AreEqual(10f, root_child0.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -136,7 +136,7 @@ namespace Facebook.CSSLayout public void Test_align_items_flex_end() { CSSNode root = new CSSNode(); - root.AlignItems = CSSAlign.FlexEnd; + root.AlignItems = YogaAlign.FlexEnd; root.Width = 100f; root.Height = 100f; @@ -144,7 +144,7 @@ namespace Facebook.CSSLayout root_child0.Width = 10f; root_child0.Height = 10f; root.Insert(0, root_child0); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -157,7 +157,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(10f, root_child0.LayoutWidth); Assert.AreEqual(10f, root_child0.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); diff --git a/csharp/tests/Facebook.CSSLayout/CSSLayoutAlignSelfTest.cs b/csharp/tests/Facebook.CSSLayout/CSSLayoutAlignSelfTest.cs index 3cb9e7a0..c7fdc958 100644 --- a/csharp/tests/Facebook.CSSLayout/CSSLayoutAlignSelfTest.cs +++ b/csharp/tests/Facebook.CSSLayout/CSSLayoutAlignSelfTest.cs @@ -25,11 +25,11 @@ namespace Facebook.CSSLayout root.Height = 100f; CSSNode root_child0 = new CSSNode(); - root_child0.AlignSelf = CSSAlign.Center; + root_child0.AlignSelf = YogaAlign.Center; root_child0.Width = 10f; root_child0.Height = 10f; root.Insert(0, root_child0); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -42,7 +42,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(10f, root_child0.LayoutWidth); Assert.AreEqual(10f, root_child0.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -64,11 +64,11 @@ namespace Facebook.CSSLayout root.Height = 100f; CSSNode root_child0 = new CSSNode(); - root_child0.AlignSelf = CSSAlign.FlexEnd; + root_child0.AlignSelf = YogaAlign.FlexEnd; root_child0.Width = 10f; root_child0.Height = 10f; root.Insert(0, root_child0); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -81,7 +81,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(10f, root_child0.LayoutWidth); Assert.AreEqual(10f, root_child0.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -103,11 +103,11 @@ namespace Facebook.CSSLayout root.Height = 100f; CSSNode root_child0 = new CSSNode(); - root_child0.AlignSelf = CSSAlign.FlexStart; + root_child0.AlignSelf = YogaAlign.FlexStart; root_child0.Width = 10f; root_child0.Height = 10f; root.Insert(0, root_child0); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -120,7 +120,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(10f, root_child0.LayoutWidth); Assert.AreEqual(10f, root_child0.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -138,16 +138,16 @@ namespace Facebook.CSSLayout public void Test_align_self_flex_end_override_flex_start() { CSSNode root = new CSSNode(); - root.AlignItems = CSSAlign.FlexStart; + root.AlignItems = YogaAlign.FlexStart; root.Width = 100f; root.Height = 100f; CSSNode root_child0 = new CSSNode(); - root_child0.AlignSelf = CSSAlign.FlexEnd; + root_child0.AlignSelf = YogaAlign.FlexEnd; root_child0.Width = 10f; root_child0.Height = 10f; root.Insert(0, root_child0); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -160,7 +160,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(10f, root_child0.LayoutWidth); Assert.AreEqual(10f, root_child0.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); diff --git a/csharp/tests/Facebook.CSSLayout/CSSLayoutBorderTest.cs b/csharp/tests/Facebook.CSSLayout/CSSLayoutBorderTest.cs index 2a2d263d..fab4b731 100644 --- a/csharp/tests/Facebook.CSSLayout/CSSLayoutBorderTest.cs +++ b/csharp/tests/Facebook.CSSLayout/CSSLayoutBorderTest.cs @@ -21,11 +21,11 @@ namespace Facebook.CSSLayout public void Test_border_no_size() { CSSNode root = new CSSNode(); - root.SetBorder(CSSEdge.Left, 10f); - root.SetBorder(CSSEdge.Top, 10f); - root.SetBorder(CSSEdge.Right, 10f); - root.SetBorder(CSSEdge.Bottom, 10f); - root.StyleDirection = CSSDirection.LTR; + root.SetBorder(YogaEdge.Left, 10f); + root.SetBorder(YogaEdge.Top, 10f); + root.SetBorder(YogaEdge.Right, 10f); + root.SetBorder(YogaEdge.Bottom, 10f); + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -33,7 +33,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(20f, root.LayoutWidth); Assert.AreEqual(20f, root.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -46,16 +46,16 @@ namespace Facebook.CSSLayout public void Test_border_container_match_child() { CSSNode root = new CSSNode(); - root.SetBorder(CSSEdge.Left, 10f); - root.SetBorder(CSSEdge.Top, 10f); - root.SetBorder(CSSEdge.Right, 10f); - root.SetBorder(CSSEdge.Bottom, 10f); + root.SetBorder(YogaEdge.Left, 10f); + root.SetBorder(YogaEdge.Top, 10f); + root.SetBorder(YogaEdge.Right, 10f); + root.SetBorder(YogaEdge.Bottom, 10f); CSSNode root_child0 = new CSSNode(); root_child0.Width = 10f; root_child0.Height = 10f; root.Insert(0, root_child0); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -68,7 +68,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(10f, root_child0.LayoutWidth); Assert.AreEqual(10f, root_child0.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -86,10 +86,10 @@ namespace Facebook.CSSLayout public void Test_border_flex_child() { CSSNode root = new CSSNode(); - root.SetBorder(CSSEdge.Left, 10f); - root.SetBorder(CSSEdge.Top, 10f); - root.SetBorder(CSSEdge.Right, 10f); - root.SetBorder(CSSEdge.Bottom, 10f); + root.SetBorder(YogaEdge.Left, 10f); + root.SetBorder(YogaEdge.Top, 10f); + root.SetBorder(YogaEdge.Right, 10f); + root.SetBorder(YogaEdge.Bottom, 10f); root.Width = 100f; root.Height = 100f; @@ -97,7 +97,7 @@ namespace Facebook.CSSLayout root_child0.FlexGrow = 1f; root_child0.Width = 10f; root.Insert(0, root_child0); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -110,7 +110,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(10f, root_child0.LayoutWidth); Assert.AreEqual(80f, root_child0.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -128,17 +128,17 @@ namespace Facebook.CSSLayout public void Test_border_stretch_child() { CSSNode root = new CSSNode(); - root.SetBorder(CSSEdge.Left, 10f); - root.SetBorder(CSSEdge.Top, 10f); - root.SetBorder(CSSEdge.Right, 10f); - root.SetBorder(CSSEdge.Bottom, 10f); + root.SetBorder(YogaEdge.Left, 10f); + root.SetBorder(YogaEdge.Top, 10f); + root.SetBorder(YogaEdge.Right, 10f); + root.SetBorder(YogaEdge.Bottom, 10f); root.Width = 100f; root.Height = 100f; CSSNode root_child0 = new CSSNode(); root_child0.Height = 10f; root.Insert(0, root_child0); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -151,7 +151,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(80f, root_child0.LayoutWidth); Assert.AreEqual(10f, root_child0.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -169,11 +169,11 @@ namespace Facebook.CSSLayout public void Test_border_center_child() { CSSNode root = new CSSNode(); - root.JustifyContent = CSSJustify.Center; - root.AlignItems = CSSAlign.Center; - root.SetBorder(CSSEdge.Start, 10f); - root.SetBorder(CSSEdge.End, 20f); - root.SetBorder(CSSEdge.Bottom, 20f); + root.JustifyContent = YogaJustify.Center; + root.AlignItems = YogaAlign.Center; + root.SetBorder(YogaEdge.Start, 10f); + root.SetBorder(YogaEdge.End, 20f); + root.SetBorder(YogaEdge.Bottom, 20f); root.Width = 100f; root.Height = 100f; @@ -181,7 +181,7 @@ namespace Facebook.CSSLayout root_child0.Width = 10f; root_child0.Height = 10f; root.Insert(0, root_child0); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -194,7 +194,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(10f, root_child0.LayoutWidth); Assert.AreEqual(10f, root_child0.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); diff --git a/csharp/tests/Facebook.CSSLayout/CSSLayoutFlexDirectionTest.cs b/csharp/tests/Facebook.CSSLayout/CSSLayoutFlexDirectionTest.cs index 0658e3bc..81d639b0 100644 --- a/csharp/tests/Facebook.CSSLayout/CSSLayoutFlexDirectionTest.cs +++ b/csharp/tests/Facebook.CSSLayout/CSSLayoutFlexDirectionTest.cs @@ -34,7 +34,7 @@ namespace Facebook.CSSLayout CSSNode root_child2 = new CSSNode(); root_child2.Height = 10f; root.Insert(2, root_child2); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -57,7 +57,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(100f, root_child2.LayoutWidth); Assert.AreEqual(10f, root_child2.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -85,7 +85,7 @@ namespace Facebook.CSSLayout public void Test_flex_direction_row_no_width() { CSSNode root = new CSSNode(); - root.FlexDirection = CSSFlexDirection.Row; + root.FlexDirection = YogaFlexDirection.Row; root.Height = 100f; CSSNode root_child0 = new CSSNode(); @@ -99,7 +99,7 @@ namespace Facebook.CSSLayout CSSNode root_child2 = new CSSNode(); root_child2.Width = 10f; root.Insert(2, root_child2); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -122,7 +122,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(10f, root_child2.LayoutWidth); Assert.AreEqual(100f, root_child2.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -164,7 +164,7 @@ namespace Facebook.CSSLayout CSSNode root_child2 = new CSSNode(); root_child2.Height = 10f; root.Insert(2, root_child2); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -187,7 +187,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(100f, root_child2.LayoutWidth); Assert.AreEqual(10f, root_child2.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -215,7 +215,7 @@ namespace Facebook.CSSLayout public void Test_flex_direction_row() { CSSNode root = new CSSNode(); - root.FlexDirection = CSSFlexDirection.Row; + root.FlexDirection = YogaFlexDirection.Row; root.Width = 100f; root.Height = 100f; @@ -230,7 +230,7 @@ namespace Facebook.CSSLayout CSSNode root_child2 = new CSSNode(); root_child2.Width = 10f; root.Insert(2, root_child2); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -253,7 +253,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(10f, root_child2.LayoutWidth); Assert.AreEqual(100f, root_child2.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -281,7 +281,7 @@ namespace Facebook.CSSLayout public void Test_flex_direction_column_reverse() { CSSNode root = new CSSNode(); - root.FlexDirection = CSSFlexDirection.ColumnReverse; + root.FlexDirection = YogaFlexDirection.ColumnReverse; root.Width = 100f; root.Height = 100f; @@ -296,7 +296,7 @@ namespace Facebook.CSSLayout CSSNode root_child2 = new CSSNode(); root_child2.Height = 10f; root.Insert(2, root_child2); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -319,7 +319,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(100f, root_child2.LayoutWidth); Assert.AreEqual(10f, root_child2.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -347,7 +347,7 @@ namespace Facebook.CSSLayout public void Test_flex_direction_row_reverse() { CSSNode root = new CSSNode(); - root.FlexDirection = CSSFlexDirection.RowReverse; + root.FlexDirection = YogaFlexDirection.RowReverse; root.Width = 100f; root.Height = 100f; @@ -362,7 +362,7 @@ namespace Facebook.CSSLayout CSSNode root_child2 = new CSSNode(); root_child2.Width = 10f; root.Insert(2, root_child2); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -385,7 +385,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(10f, root_child2.LayoutWidth); Assert.AreEqual(100f, root_child2.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); diff --git a/csharp/tests/Facebook.CSSLayout/CSSLayoutFlexTest.cs b/csharp/tests/Facebook.CSSLayout/CSSLayoutFlexTest.cs index 27c8099c..995eec52 100644 --- a/csharp/tests/Facebook.CSSLayout/CSSLayoutFlexTest.cs +++ b/csharp/tests/Facebook.CSSLayout/CSSLayoutFlexTest.cs @@ -32,7 +32,7 @@ namespace Facebook.CSSLayout CSSNode root_child1 = new CSSNode(); root_child1.FlexGrow = 1f; root.Insert(1, root_child1); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -50,7 +50,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(100f, root_child1.LayoutWidth); Assert.AreEqual(25f, root_child1.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -73,7 +73,7 @@ namespace Facebook.CSSLayout public void Test_flex_basis_flex_grow_row() { CSSNode root = new CSSNode(); - root.FlexDirection = CSSFlexDirection.Row; + root.FlexDirection = YogaFlexDirection.Row; root.Width = 100f; root.Height = 100f; @@ -85,7 +85,7 @@ namespace Facebook.CSSLayout CSSNode root_child1 = new CSSNode(); root_child1.FlexGrow = 1f; root.Insert(1, root_child1); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -103,7 +103,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(25f, root_child1.LayoutWidth); Assert.AreEqual(100f, root_child1.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -137,7 +137,7 @@ namespace Facebook.CSSLayout CSSNode root_child1 = new CSSNode(); root_child1.FlexBasis = 50f; root.Insert(1, root_child1); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -155,7 +155,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(100f, root_child1.LayoutWidth); Assert.AreEqual(50f, root_child1.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -178,7 +178,7 @@ namespace Facebook.CSSLayout public void Test_flex_basis_flex_shrink_row() { CSSNode root = new CSSNode(); - root.FlexDirection = CSSFlexDirection.Row; + root.FlexDirection = YogaFlexDirection.Row; root.Width = 100f; root.Height = 100f; @@ -190,7 +190,7 @@ namespace Facebook.CSSLayout CSSNode root_child1 = new CSSNode(); root_child1.FlexBasis = 50f; root.Insert(1, root_child1); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -208,7 +208,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(50f, root_child1.LayoutWidth); Assert.AreEqual(100f, root_child1.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -248,7 +248,7 @@ namespace Facebook.CSSLayout root_child2.Width = 50f; root_child2.Height = 50f; root.Insert(2, root_child2); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -271,7 +271,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(50f, root_child2.LayoutWidth); Assert.AreEqual(50f, root_child2.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -317,7 +317,7 @@ namespace Facebook.CSSLayout root_child2.FlexGrow = 1f; root_child2.Height = 10f; root.Insert(2, root_child2); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -340,7 +340,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(100f, root_child2.LayoutWidth); Assert.AreEqual(20f, root_child2.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -378,7 +378,7 @@ namespace Facebook.CSSLayout root_child0_child0.FlexGrow = 1f; root_child0_child0.FlexShrink = 1f; root_child0.Insert(0, root_child0_child0); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -396,7 +396,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(100f, root_child0_child0.LayoutWidth); Assert.AreEqual(0f, root_child0_child0.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); diff --git a/csharp/tests/Facebook.CSSLayout/CSSLayoutFlexWrapTest.cs b/csharp/tests/Facebook.CSSLayout/CSSLayoutFlexWrapTest.cs index 3f52a8fb..7ea50ec3 100644 --- a/csharp/tests/Facebook.CSSLayout/CSSLayoutFlexWrapTest.cs +++ b/csharp/tests/Facebook.CSSLayout/CSSLayoutFlexWrapTest.cs @@ -21,7 +21,7 @@ namespace Facebook.CSSLayout public void Test_wrap_column() { CSSNode root = new CSSNode(); - root.Wrap = CSSWrap.Wrap; + root.Wrap = YogaWrap.Wrap; root.Height = 100f; CSSNode root_child0 = new CSSNode(); @@ -43,7 +43,7 @@ namespace Facebook.CSSLayout root_child3.Width = 30f; root_child3.Height = 30f; root.Insert(3, root_child3); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -71,7 +71,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(30f, root_child3.LayoutWidth); Assert.AreEqual(30f, root_child3.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -104,8 +104,8 @@ namespace Facebook.CSSLayout public void Test_wrap_row() { CSSNode root = new CSSNode(); - root.FlexDirection = CSSFlexDirection.Row; - root.Wrap = CSSWrap.Wrap; + root.FlexDirection = YogaFlexDirection.Row; + root.Wrap = YogaWrap.Wrap; root.Width = 100f; CSSNode root_child0 = new CSSNode(); @@ -127,7 +127,7 @@ namespace Facebook.CSSLayout root_child3.Width = 30f; root_child3.Height = 30f; root.Insert(3, root_child3); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -155,7 +155,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(30f, root_child3.LayoutWidth); Assert.AreEqual(30f, root_child3.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -188,9 +188,9 @@ namespace Facebook.CSSLayout public void Test_wrap_row_align_items_flex_end() { CSSNode root = new CSSNode(); - root.FlexDirection = CSSFlexDirection.Row; - root.AlignItems = CSSAlign.FlexEnd; - root.Wrap = CSSWrap.Wrap; + root.FlexDirection = YogaFlexDirection.Row; + root.AlignItems = YogaAlign.FlexEnd; + root.Wrap = YogaWrap.Wrap; root.Width = 100f; CSSNode root_child0 = new CSSNode(); @@ -212,7 +212,7 @@ namespace Facebook.CSSLayout root_child3.Width = 30f; root_child3.Height = 30f; root.Insert(3, root_child3); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -240,7 +240,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(30f, root_child3.LayoutWidth); Assert.AreEqual(30f, root_child3.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -273,9 +273,9 @@ namespace Facebook.CSSLayout public void Test_wrap_row_align_items_center() { CSSNode root = new CSSNode(); - root.FlexDirection = CSSFlexDirection.Row; - root.AlignItems = CSSAlign.Center; - root.Wrap = CSSWrap.Wrap; + root.FlexDirection = YogaFlexDirection.Row; + root.AlignItems = YogaAlign.Center; + root.Wrap = YogaWrap.Wrap; root.Width = 100f; CSSNode root_child0 = new CSSNode(); @@ -297,7 +297,7 @@ namespace Facebook.CSSLayout root_child3.Width = 30f; root_child3.Height = 30f; root.Insert(3, root_child3); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -325,7 +325,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(30f, root_child3.LayoutWidth); Assert.AreEqual(30f, root_child3.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); diff --git a/csharp/tests/Facebook.CSSLayout/CSSLayoutJustifyContentTest.cs b/csharp/tests/Facebook.CSSLayout/CSSLayoutJustifyContentTest.cs index 849b2be1..1a2a3ea7 100644 --- a/csharp/tests/Facebook.CSSLayout/CSSLayoutJustifyContentTest.cs +++ b/csharp/tests/Facebook.CSSLayout/CSSLayoutJustifyContentTest.cs @@ -21,7 +21,7 @@ namespace Facebook.CSSLayout public void Test_justify_content_row_flex_start() { CSSNode root = new CSSNode(); - root.FlexDirection = CSSFlexDirection.Row; + root.FlexDirection = YogaFlexDirection.Row; root.Width = 102f; root.Height = 102f; @@ -36,7 +36,7 @@ namespace Facebook.CSSLayout CSSNode root_child2 = new CSSNode(); root_child2.Width = 10f; root.Insert(2, root_child2); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -59,7 +59,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(10f, root_child2.LayoutWidth); Assert.AreEqual(102f, root_child2.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -87,8 +87,8 @@ namespace Facebook.CSSLayout public void Test_justify_content_row_flex_end() { CSSNode root = new CSSNode(); - root.FlexDirection = CSSFlexDirection.Row; - root.JustifyContent = CSSJustify.FlexEnd; + root.FlexDirection = YogaFlexDirection.Row; + root.JustifyContent = YogaJustify.FlexEnd; root.Width = 102f; root.Height = 102f; @@ -103,7 +103,7 @@ namespace Facebook.CSSLayout CSSNode root_child2 = new CSSNode(); root_child2.Width = 10f; root.Insert(2, root_child2); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -126,7 +126,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(10f, root_child2.LayoutWidth); Assert.AreEqual(102f, root_child2.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -154,8 +154,8 @@ namespace Facebook.CSSLayout public void Test_justify_content_row_center() { CSSNode root = new CSSNode(); - root.FlexDirection = CSSFlexDirection.Row; - root.JustifyContent = CSSJustify.Center; + root.FlexDirection = YogaFlexDirection.Row; + root.JustifyContent = YogaJustify.Center; root.Width = 102f; root.Height = 102f; @@ -170,7 +170,7 @@ namespace Facebook.CSSLayout CSSNode root_child2 = new CSSNode(); root_child2.Width = 10f; root.Insert(2, root_child2); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -193,7 +193,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(10f, root_child2.LayoutWidth); Assert.AreEqual(102f, root_child2.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -221,8 +221,8 @@ namespace Facebook.CSSLayout public void Test_justify_content_row_space_between() { CSSNode root = new CSSNode(); - root.FlexDirection = CSSFlexDirection.Row; - root.JustifyContent = CSSJustify.SpaceBetween; + root.FlexDirection = YogaFlexDirection.Row; + root.JustifyContent = YogaJustify.SpaceBetween; root.Width = 102f; root.Height = 102f; @@ -237,7 +237,7 @@ namespace Facebook.CSSLayout CSSNode root_child2 = new CSSNode(); root_child2.Width = 10f; root.Insert(2, root_child2); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -260,7 +260,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(10f, root_child2.LayoutWidth); Assert.AreEqual(102f, root_child2.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -288,8 +288,8 @@ namespace Facebook.CSSLayout public void Test_justify_content_row_space_around() { CSSNode root = new CSSNode(); - root.FlexDirection = CSSFlexDirection.Row; - root.JustifyContent = CSSJustify.SpaceAround; + root.FlexDirection = YogaFlexDirection.Row; + root.JustifyContent = YogaJustify.SpaceAround; root.Width = 102f; root.Height = 102f; @@ -304,7 +304,7 @@ namespace Facebook.CSSLayout CSSNode root_child2 = new CSSNode(); root_child2.Width = 10f; root.Insert(2, root_child2); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -327,7 +327,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(10f, root_child2.LayoutWidth); Assert.AreEqual(102f, root_child2.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -368,7 +368,7 @@ namespace Facebook.CSSLayout CSSNode root_child2 = new CSSNode(); root_child2.Height = 10f; root.Insert(2, root_child2); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -391,7 +391,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(102f, root_child2.LayoutWidth); Assert.AreEqual(10f, root_child2.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -419,7 +419,7 @@ namespace Facebook.CSSLayout public void Test_justify_content_column_flex_end() { CSSNode root = new CSSNode(); - root.JustifyContent = CSSJustify.FlexEnd; + root.JustifyContent = YogaJustify.FlexEnd; root.Width = 102f; root.Height = 102f; @@ -434,7 +434,7 @@ namespace Facebook.CSSLayout CSSNode root_child2 = new CSSNode(); root_child2.Height = 10f; root.Insert(2, root_child2); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -457,7 +457,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(102f, root_child2.LayoutWidth); Assert.AreEqual(10f, root_child2.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -485,7 +485,7 @@ namespace Facebook.CSSLayout public void Test_justify_content_column_center() { CSSNode root = new CSSNode(); - root.JustifyContent = CSSJustify.Center; + root.JustifyContent = YogaJustify.Center; root.Width = 102f; root.Height = 102f; @@ -500,7 +500,7 @@ namespace Facebook.CSSLayout CSSNode root_child2 = new CSSNode(); root_child2.Height = 10f; root.Insert(2, root_child2); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -523,7 +523,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(102f, root_child2.LayoutWidth); Assert.AreEqual(10f, root_child2.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -551,7 +551,7 @@ namespace Facebook.CSSLayout public void Test_justify_content_column_space_between() { CSSNode root = new CSSNode(); - root.JustifyContent = CSSJustify.SpaceBetween; + root.JustifyContent = YogaJustify.SpaceBetween; root.Width = 102f; root.Height = 102f; @@ -566,7 +566,7 @@ namespace Facebook.CSSLayout CSSNode root_child2 = new CSSNode(); root_child2.Height = 10f; root.Insert(2, root_child2); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -589,7 +589,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(102f, root_child2.LayoutWidth); Assert.AreEqual(10f, root_child2.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -617,7 +617,7 @@ namespace Facebook.CSSLayout public void Test_justify_content_column_space_around() { CSSNode root = new CSSNode(); - root.JustifyContent = CSSJustify.SpaceAround; + root.JustifyContent = YogaJustify.SpaceAround; root.Width = 102f; root.Height = 102f; @@ -632,7 +632,7 @@ namespace Facebook.CSSLayout CSSNode root_child2 = new CSSNode(); root_child2.Height = 10f; root.Insert(2, root_child2); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -655,7 +655,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(102f, root_child2.LayoutWidth); Assert.AreEqual(10f, root_child2.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); diff --git a/csharp/tests/Facebook.CSSLayout/CSSLayoutMarginTest.cs b/csharp/tests/Facebook.CSSLayout/CSSLayoutMarginTest.cs index a7791c07..e6030df8 100644 --- a/csharp/tests/Facebook.CSSLayout/CSSLayoutMarginTest.cs +++ b/csharp/tests/Facebook.CSSLayout/CSSLayoutMarginTest.cs @@ -21,15 +21,15 @@ namespace Facebook.CSSLayout public void Test_margin_start() { CSSNode root = new CSSNode(); - root.FlexDirection = CSSFlexDirection.Row; + root.FlexDirection = YogaFlexDirection.Row; root.Width = 100f; root.Height = 100f; CSSNode root_child0 = new CSSNode(); - root_child0.SetMargin(CSSEdge.Start, 10f); + root_child0.SetMargin(YogaEdge.Start, 10f); root_child0.Width = 10f; root.Insert(0, root_child0); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -42,7 +42,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(10f, root_child0.LayoutWidth); Assert.AreEqual(100f, root_child0.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -64,10 +64,10 @@ namespace Facebook.CSSLayout root.Height = 100f; CSSNode root_child0 = new CSSNode(); - root_child0.SetMargin(CSSEdge.Top, 10f); + root_child0.SetMargin(YogaEdge.Top, 10f); root_child0.Height = 10f; root.Insert(0, root_child0); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -80,7 +80,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(100f, root_child0.LayoutWidth); Assert.AreEqual(10f, root_child0.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -98,16 +98,16 @@ namespace Facebook.CSSLayout public void Test_margin_end() { CSSNode root = new CSSNode(); - root.FlexDirection = CSSFlexDirection.Row; - root.JustifyContent = CSSJustify.FlexEnd; + root.FlexDirection = YogaFlexDirection.Row; + root.JustifyContent = YogaJustify.FlexEnd; root.Width = 100f; root.Height = 100f; CSSNode root_child0 = new CSSNode(); - root_child0.SetMargin(CSSEdge.End, 10f); + root_child0.SetMargin(YogaEdge.End, 10f); root_child0.Width = 10f; root.Insert(0, root_child0); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -120,7 +120,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(10f, root_child0.LayoutWidth); Assert.AreEqual(100f, root_child0.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -138,15 +138,15 @@ namespace Facebook.CSSLayout public void Test_margin_bottom() { CSSNode root = new CSSNode(); - root.JustifyContent = CSSJustify.FlexEnd; + root.JustifyContent = YogaJustify.FlexEnd; root.Width = 100f; root.Height = 100f; CSSNode root_child0 = new CSSNode(); - root_child0.SetMargin(CSSEdge.Bottom, 10f); + root_child0.SetMargin(YogaEdge.Bottom, 10f); root_child0.Height = 10f; root.Insert(0, root_child0); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -159,7 +159,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(100f, root_child0.LayoutWidth); Assert.AreEqual(10f, root_child0.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -177,15 +177,15 @@ namespace Facebook.CSSLayout public void Test_margin_and_flex_row() { CSSNode root = new CSSNode(); - root.FlexDirection = CSSFlexDirection.Row; + root.FlexDirection = YogaFlexDirection.Row; root.Width = 100f; root.Height = 100f; CSSNode root_child0 = new CSSNode(); root_child0.FlexGrow = 1f; - root_child0.SetMargin(CSSEdge.Start, 10f); + root_child0.SetMargin(YogaEdge.Start, 10f); root.Insert(0, root_child0); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -198,7 +198,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(90f, root_child0.LayoutWidth); Assert.AreEqual(100f, root_child0.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -221,9 +221,9 @@ namespace Facebook.CSSLayout CSSNode root_child0 = new CSSNode(); root_child0.FlexGrow = 1f; - root_child0.SetMargin(CSSEdge.Top, 10f); + root_child0.SetMargin(YogaEdge.Top, 10f); root.Insert(0, root_child0); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -236,7 +236,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(100f, root_child0.LayoutWidth); Assert.AreEqual(90f, root_child0.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -254,15 +254,15 @@ namespace Facebook.CSSLayout public void Test_margin_and_stretch_row() { CSSNode root = new CSSNode(); - root.FlexDirection = CSSFlexDirection.Row; + root.FlexDirection = YogaFlexDirection.Row; root.Width = 100f; root.Height = 100f; CSSNode root_child0 = new CSSNode(); root_child0.FlexGrow = 1f; - root_child0.SetMargin(CSSEdge.Top, 10f); + root_child0.SetMargin(YogaEdge.Top, 10f); root.Insert(0, root_child0); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -275,7 +275,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(100f, root_child0.LayoutWidth); Assert.AreEqual(90f, root_child0.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -298,9 +298,9 @@ namespace Facebook.CSSLayout CSSNode root_child0 = new CSSNode(); root_child0.FlexGrow = 1f; - root_child0.SetMargin(CSSEdge.Start, 10f); + root_child0.SetMargin(YogaEdge.Start, 10f); root.Insert(0, root_child0); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -313,7 +313,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(90f, root_child0.LayoutWidth); Assert.AreEqual(100f, root_child0.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -331,7 +331,7 @@ namespace Facebook.CSSLayout public void Test_margin_with_sibling_row() { CSSNode root = new CSSNode(); - root.FlexDirection = CSSFlexDirection.Row; + root.FlexDirection = YogaFlexDirection.Row; root.Width = 100f; root.Height = 100f; @@ -342,7 +342,7 @@ namespace Facebook.CSSLayout CSSNode root_child1 = new CSSNode(); root_child1.FlexGrow = 1f; root.Insert(1, root_child1); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -360,7 +360,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(50f, root_child1.LayoutWidth); Assert.AreEqual(100f, root_child1.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -393,7 +393,7 @@ namespace Facebook.CSSLayout CSSNode root_child1 = new CSSNode(); root_child1.FlexGrow = 1f; root.Insert(1, root_child1); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -411,7 +411,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(100f, root_child1.LayoutWidth); Assert.AreEqual(50f, root_child1.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); diff --git a/csharp/tests/Facebook.CSSLayout/CSSLayoutMinMaxDimensionTest.cs b/csharp/tests/Facebook.CSSLayout/CSSLayoutMinMaxDimensionTest.cs index 3b88d4f1..dcfa7f1a 100644 --- a/csharp/tests/Facebook.CSSLayout/CSSLayoutMinMaxDimensionTest.cs +++ b/csharp/tests/Facebook.CSSLayout/CSSLayoutMinMaxDimensionTest.cs @@ -28,7 +28,7 @@ namespace Facebook.CSSLayout root_child0.MaxWidth = 50f; root_child0.Height = 10f; root.Insert(0, root_child0); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -41,7 +41,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(50f, root_child0.LayoutWidth); Assert.AreEqual(10f, root_child0.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -59,7 +59,7 @@ namespace Facebook.CSSLayout public void Test_max_height() { CSSNode root = new CSSNode(); - root.FlexDirection = CSSFlexDirection.Row; + root.FlexDirection = YogaFlexDirection.Row; root.Width = 100f; root.Height = 100f; @@ -67,7 +67,7 @@ namespace Facebook.CSSLayout root_child0.Width = 10f; root_child0.MaxHeight = 50f; root.Insert(0, root_child0); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -80,7 +80,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(10f, root_child0.LayoutWidth); Assert.AreEqual(50f, root_child0.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -109,7 +109,7 @@ namespace Facebook.CSSLayout CSSNode root_child1 = new CSSNode(); root_child1.FlexGrow = 1f; root.Insert(1, root_child1); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -127,7 +127,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(100f, root_child1.LayoutWidth); Assert.AreEqual(20f, root_child1.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -150,7 +150,7 @@ namespace Facebook.CSSLayout public void Test_min_width() { CSSNode root = new CSSNode(); - root.FlexDirection = CSSFlexDirection.Row; + root.FlexDirection = YogaFlexDirection.Row; root.Width = 100f; root.Height = 100f; @@ -162,7 +162,7 @@ namespace Facebook.CSSLayout CSSNode root_child1 = new CSSNode(); root_child1.FlexGrow = 1f; root.Insert(1, root_child1); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -180,7 +180,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(20f, root_child1.LayoutWidth); Assert.AreEqual(100f, root_child1.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -203,7 +203,7 @@ namespace Facebook.CSSLayout public void Test_justify_content_min_max() { CSSNode root = new CSSNode(); - root.JustifyContent = CSSJustify.Center; + root.JustifyContent = YogaJustify.Center; root.Width = 100f; root.MinHeight = 100f; root.MaxHeight = 200f; @@ -212,7 +212,7 @@ namespace Facebook.CSSLayout root_child0.Width = 60f; root_child0.Height = 60f; root.Insert(0, root_child0); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -225,7 +225,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(60f, root_child0.LayoutWidth); Assert.AreEqual(60f, root_child0.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -243,7 +243,7 @@ namespace Facebook.CSSLayout public void Test_align_items_min_max() { CSSNode root = new CSSNode(); - root.AlignItems = CSSAlign.Center; + root.AlignItems = YogaAlign.Center; root.MinWidth = 100f; root.MaxWidth = 200f; root.Height = 100f; @@ -252,7 +252,7 @@ namespace Facebook.CSSLayout root_child0.Width = 60f; root_child0.Height = 60f; root.Insert(0, root_child0); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -265,7 +265,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(60f, root_child0.LayoutWidth); Assert.AreEqual(60f, root_child0.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -283,7 +283,7 @@ namespace Facebook.CSSLayout public void Test_justify_content_overflow_min_max() { CSSNode root = new CSSNode(); - root.JustifyContent = CSSJustify.Center; + root.JustifyContent = YogaJustify.Center; root.MinHeight = 100f; root.MaxHeight = 110f; @@ -301,7 +301,7 @@ namespace Facebook.CSSLayout root_child2.Width = 50f; root_child2.Height = 50f; root.Insert(2, root_child2); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -324,7 +324,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(50f, root_child2.LayoutWidth); Assert.AreEqual(50f, root_child2.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -356,7 +356,7 @@ namespace Facebook.CSSLayout root.Height = 100f; CSSNode root_child0 = new CSSNode(); - root_child0.FlexDirection = CSSFlexDirection.Row; + root_child0.FlexDirection = YogaFlexDirection.Row; root_child0.MaxWidth = 100f; root.Insert(0, root_child0); @@ -364,7 +364,7 @@ namespace Facebook.CSSLayout root_child0_child0.FlexGrow = 1f; root_child0_child0.Height = 20f; root_child0.Insert(0, root_child0_child0); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -382,7 +382,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(100f, root_child0_child0.LayoutWidth); Assert.AreEqual(20f, root_child0_child0.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -409,7 +409,7 @@ namespace Facebook.CSSLayout root.Height = 100f; CSSNode root_child0 = new CSSNode(); - root_child0.FlexDirection = CSSFlexDirection.Row; + root_child0.FlexDirection = YogaFlexDirection.Row; root_child0.MaxWidth = 300f; root.Insert(0, root_child0); @@ -417,7 +417,7 @@ namespace Facebook.CSSLayout root_child0_child0.FlexGrow = 1f; root_child0_child0.Height = 20f; root_child0.Insert(0, root_child0_child0); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -435,7 +435,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(200f, root_child0_child0.LayoutWidth); Assert.AreEqual(20f, root_child0_child0.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); diff --git a/csharp/tests/Facebook.CSSLayout/CSSLayoutPaddingTest.cs b/csharp/tests/Facebook.CSSLayout/CSSLayoutPaddingTest.cs index 02a5fa15..c9ec0ae6 100644 --- a/csharp/tests/Facebook.CSSLayout/CSSLayoutPaddingTest.cs +++ b/csharp/tests/Facebook.CSSLayout/CSSLayoutPaddingTest.cs @@ -21,11 +21,11 @@ namespace Facebook.CSSLayout public void Test_padding_no_size() { CSSNode root = new CSSNode(); - root.SetPadding(CSSEdge.Left, 10f); - root.SetPadding(CSSEdge.Top, 10f); - root.SetPadding(CSSEdge.Right, 10f); - root.SetPadding(CSSEdge.Bottom, 10f); - root.StyleDirection = CSSDirection.LTR; + root.SetPadding(YogaEdge.Left, 10f); + root.SetPadding(YogaEdge.Top, 10f); + root.SetPadding(YogaEdge.Right, 10f); + root.SetPadding(YogaEdge.Bottom, 10f); + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -33,7 +33,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(20f, root.LayoutWidth); Assert.AreEqual(20f, root.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -46,16 +46,16 @@ namespace Facebook.CSSLayout public void Test_padding_container_match_child() { CSSNode root = new CSSNode(); - root.SetPadding(CSSEdge.Left, 10f); - root.SetPadding(CSSEdge.Top, 10f); - root.SetPadding(CSSEdge.Right, 10f); - root.SetPadding(CSSEdge.Bottom, 10f); + root.SetPadding(YogaEdge.Left, 10f); + root.SetPadding(YogaEdge.Top, 10f); + root.SetPadding(YogaEdge.Right, 10f); + root.SetPadding(YogaEdge.Bottom, 10f); CSSNode root_child0 = new CSSNode(); root_child0.Width = 10f; root_child0.Height = 10f; root.Insert(0, root_child0); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -68,7 +68,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(10f, root_child0.LayoutWidth); Assert.AreEqual(10f, root_child0.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -86,10 +86,10 @@ namespace Facebook.CSSLayout public void Test_padding_flex_child() { CSSNode root = new CSSNode(); - root.SetPadding(CSSEdge.Left, 10f); - root.SetPadding(CSSEdge.Top, 10f); - root.SetPadding(CSSEdge.Right, 10f); - root.SetPadding(CSSEdge.Bottom, 10f); + root.SetPadding(YogaEdge.Left, 10f); + root.SetPadding(YogaEdge.Top, 10f); + root.SetPadding(YogaEdge.Right, 10f); + root.SetPadding(YogaEdge.Bottom, 10f); root.Width = 100f; root.Height = 100f; @@ -97,7 +97,7 @@ namespace Facebook.CSSLayout root_child0.FlexGrow = 1f; root_child0.Width = 10f; root.Insert(0, root_child0); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -110,7 +110,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(10f, root_child0.LayoutWidth); Assert.AreEqual(80f, root_child0.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -128,17 +128,17 @@ namespace Facebook.CSSLayout public void Test_padding_stretch_child() { CSSNode root = new CSSNode(); - root.SetPadding(CSSEdge.Left, 10f); - root.SetPadding(CSSEdge.Top, 10f); - root.SetPadding(CSSEdge.Right, 10f); - root.SetPadding(CSSEdge.Bottom, 10f); + root.SetPadding(YogaEdge.Left, 10f); + root.SetPadding(YogaEdge.Top, 10f); + root.SetPadding(YogaEdge.Right, 10f); + root.SetPadding(YogaEdge.Bottom, 10f); root.Width = 100f; root.Height = 100f; CSSNode root_child0 = new CSSNode(); root_child0.Height = 10f; root.Insert(0, root_child0); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -151,7 +151,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(80f, root_child0.LayoutWidth); Assert.AreEqual(10f, root_child0.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -169,11 +169,11 @@ namespace Facebook.CSSLayout public void Test_padding_center_child() { CSSNode root = new CSSNode(); - root.JustifyContent = CSSJustify.Center; - root.AlignItems = CSSAlign.Center; - root.SetPadding(CSSEdge.Start, 10f); - root.SetPadding(CSSEdge.End, 20f); - root.SetPadding(CSSEdge.Bottom, 20f); + root.JustifyContent = YogaJustify.Center; + root.AlignItems = YogaAlign.Center; + root.SetPadding(YogaEdge.Start, 10f); + root.SetPadding(YogaEdge.End, 20f); + root.SetPadding(YogaEdge.Bottom, 20f); root.Width = 100f; root.Height = 100f; @@ -181,7 +181,7 @@ namespace Facebook.CSSLayout root_child0.Width = 10f; root_child0.Height = 10f; root.Insert(0, root_child0); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -194,7 +194,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(10f, root_child0.LayoutWidth); Assert.AreEqual(10f, root_child0.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -212,20 +212,20 @@ namespace Facebook.CSSLayout public void Test_child_with_padding_align_end() { CSSNode root = new CSSNode(); - root.JustifyContent = CSSJustify.FlexEnd; - root.AlignItems = CSSAlign.FlexEnd; + root.JustifyContent = YogaJustify.FlexEnd; + root.AlignItems = YogaAlign.FlexEnd; root.Width = 200f; root.Height = 200f; CSSNode root_child0 = new CSSNode(); - root_child0.SetPadding(CSSEdge.Left, 20f); - root_child0.SetPadding(CSSEdge.Top, 20f); - root_child0.SetPadding(CSSEdge.Right, 20f); - root_child0.SetPadding(CSSEdge.Bottom, 20f); + root_child0.SetPadding(YogaEdge.Left, 20f); + root_child0.SetPadding(YogaEdge.Top, 20f); + root_child0.SetPadding(YogaEdge.Right, 20f); + root_child0.SetPadding(YogaEdge.Bottom, 20f); root_child0.Width = 100f; root_child0.Height = 100f; root.Insert(0, root_child0); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -238,7 +238,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(100f, root_child0.LayoutWidth); Assert.AreEqual(100f, root_child0.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); diff --git a/csharp/tests/Facebook.CSSLayout/CSSLayoutRoundingTest.cs b/csharp/tests/Facebook.CSSLayout/CSSLayoutRoundingTest.cs index cfd11f1e..36b255de 100644 --- a/csharp/tests/Facebook.CSSLayout/CSSLayoutRoundingTest.cs +++ b/csharp/tests/Facebook.CSSLayout/CSSLayoutRoundingTest.cs @@ -20,10 +20,10 @@ namespace Facebook.CSSLayout [Test] public void Test_rounding_flex_basis_flex_grow_row_width_of_100() { - CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, true); + CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true); CSSNode root = new CSSNode(); - root.FlexDirection = CSSFlexDirection.Row; + root.FlexDirection = YogaFlexDirection.Row; root.Width = 100f; root.Height = 100f; @@ -38,7 +38,7 @@ namespace Facebook.CSSLayout CSSNode root_child2 = new CSSNode(); root_child2.FlexGrow = 1f; root.Insert(2, root_child2); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -61,7 +61,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(33f, root_child2.LayoutWidth); Assert.AreEqual(100f, root_child2.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -84,16 +84,16 @@ namespace Facebook.CSSLayout Assert.AreEqual(33f, root_child2.LayoutWidth); Assert.AreEqual(100f, root_child2.LayoutHeight); - CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, false); + CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false); } [Test] public void Test_rounding_flex_basis_flex_grow_row_prime_number_width() { - CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, true); + CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true); CSSNode root = new CSSNode(); - root.FlexDirection = CSSFlexDirection.Row; + root.FlexDirection = YogaFlexDirection.Row; root.Width = 113f; root.Height = 100f; @@ -116,7 +116,7 @@ namespace Facebook.CSSLayout CSSNode root_child4 = new CSSNode(); root_child4.FlexGrow = 1f; root.Insert(4, root_child4); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -149,7 +149,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(23f, root_child4.LayoutWidth); Assert.AreEqual(100f, root_child4.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -182,16 +182,16 @@ namespace Facebook.CSSLayout Assert.AreEqual(23f, root_child4.LayoutWidth); Assert.AreEqual(100f, root_child4.LayoutHeight); - CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, false); + CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false); } [Test] public void Test_rounding_flex_basis_flex_shrink_row() { - CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, true); + CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true); CSSNode root = new CSSNode(); - root.FlexDirection = CSSFlexDirection.Row; + root.FlexDirection = YogaFlexDirection.Row; root.Width = 101f; root.Height = 100f; @@ -207,7 +207,7 @@ namespace Facebook.CSSLayout CSSNode root_child2 = new CSSNode(); root_child2.FlexBasis = 25f; root.Insert(2, root_child2); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -230,7 +230,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(25f, root_child2.LayoutWidth); Assert.AreEqual(100f, root_child2.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -253,13 +253,13 @@ namespace Facebook.CSSLayout Assert.AreEqual(25f, root_child2.LayoutWidth); Assert.AreEqual(100f, root_child2.LayoutHeight); - CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, false); + CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false); } [Test] public void Test_rounding_flex_basis_overrides_main_size() { - CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, true); + CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true); CSSNode root = new CSSNode(); root.Width = 100f; @@ -280,7 +280,7 @@ namespace Facebook.CSSLayout root_child2.FlexGrow = 1f; root_child2.Height = 10f; root.Insert(2, root_child2); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -303,7 +303,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(100f, root_child2.LayoutWidth); Assert.AreEqual(24f, root_child2.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -326,13 +326,13 @@ namespace Facebook.CSSLayout Assert.AreEqual(100f, root_child2.LayoutWidth); Assert.AreEqual(24f, root_child2.LayoutHeight); - CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, false); + CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false); } [Test] public void Test_rounding_total_fractial() { - CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, true); + CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true); CSSNode root = new CSSNode(); root.Width = 87.4f; @@ -353,7 +353,7 @@ namespace Facebook.CSSLayout root_child2.FlexGrow = 1.1f; root_child2.Height = 10.7f; root.Insert(2, root_child2); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -376,7 +376,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(87f, root_child2.LayoutWidth); Assert.AreEqual(24f, root_child2.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -399,13 +399,13 @@ namespace Facebook.CSSLayout Assert.AreEqual(87f, root_child2.LayoutWidth); Assert.AreEqual(24f, root_child2.LayoutHeight); - CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, false); + CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false); } [Test] public void Test_rounding_total_fractial_nested() { - CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, true); + CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true); CSSNode root = new CSSNode(); root.Width = 87.4f; @@ -420,14 +420,14 @@ namespace Facebook.CSSLayout CSSNode root_child0_child0 = new CSSNode(); root_child0_child0.FlexGrow = 1f; root_child0_child0.FlexBasis = 0.3f; - root_child0_child0.SetPosition(CSSEdge.Bottom, 13.3f); + root_child0_child0.SetPosition(YogaEdge.Bottom, 13.3f); root_child0_child0.Height = 9.9f; root_child0.Insert(0, root_child0_child0); CSSNode root_child0_child1 = new CSSNode(); root_child0_child1.FlexGrow = 4f; root_child0_child1.FlexBasis = 0.3f; - root_child0_child1.SetPosition(CSSEdge.Top, 13.3f); + root_child0_child1.SetPosition(YogaEdge.Top, 13.3f); root_child0_child1.Height = 1.1f; root_child0.Insert(1, root_child0_child1); @@ -440,7 +440,7 @@ namespace Facebook.CSSLayout root_child2.FlexGrow = 1.1f; root_child2.Height = 10.7f; root.Insert(2, root_child2); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -473,7 +473,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(87f, root_child2.LayoutWidth); Assert.AreEqual(24f, root_child2.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -506,13 +506,13 @@ namespace Facebook.CSSLayout Assert.AreEqual(87f, root_child2.LayoutWidth); Assert.AreEqual(24f, root_child2.LayoutHeight); - CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, false); + CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false); } [Test] public void Test_rounding_fractial_input_1() { - CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, true); + CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true); CSSNode root = new CSSNode(); root.Width = 100f; @@ -533,7 +533,7 @@ namespace Facebook.CSSLayout root_child2.FlexGrow = 1f; root_child2.Height = 10f; root.Insert(2, root_child2); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -556,7 +556,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(100f, root_child2.LayoutWidth); Assert.AreEqual(24f, root_child2.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -579,13 +579,13 @@ namespace Facebook.CSSLayout Assert.AreEqual(100f, root_child2.LayoutWidth); Assert.AreEqual(24f, root_child2.LayoutHeight); - CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, false); + CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false); } [Test] public void Test_rounding_fractial_input_2() { - CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, true); + CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true); CSSNode root = new CSSNode(); root.Width = 100f; @@ -606,7 +606,7 @@ namespace Facebook.CSSLayout root_child2.FlexGrow = 1f; root_child2.Height = 10f; root.Insert(2, root_child2); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -629,7 +629,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(100f, root_child2.LayoutWidth); Assert.AreEqual(25f, root_child2.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -652,16 +652,16 @@ namespace Facebook.CSSLayout Assert.AreEqual(100f, root_child2.LayoutWidth); Assert.AreEqual(25f, root_child2.LayoutHeight); - CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, false); + CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false); } [Test] public void Test_rounding_fractial_input_3() { - CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, true); + CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true); CSSNode root = new CSSNode(); - root.SetPosition(CSSEdge.Top, 0.3f); + root.SetPosition(YogaEdge.Top, 0.3f); root.Width = 100f; root.Height = 113.4f; @@ -680,7 +680,7 @@ namespace Facebook.CSSLayout root_child2.FlexGrow = 1f; root_child2.Height = 10f; root.Insert(2, root_child2); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -703,7 +703,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(100f, root_child2.LayoutWidth); Assert.AreEqual(24f, root_child2.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -726,16 +726,16 @@ namespace Facebook.CSSLayout Assert.AreEqual(100f, root_child2.LayoutWidth); Assert.AreEqual(24f, root_child2.LayoutHeight); - CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, false); + CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false); } [Test] public void Test_rounding_fractial_input_4() { - CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, true); + CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true); CSSNode root = new CSSNode(); - root.SetPosition(CSSEdge.Top, 0.7f); + root.SetPosition(YogaEdge.Top, 0.7f); root.Width = 100f; root.Height = 113.4f; @@ -754,7 +754,7 @@ namespace Facebook.CSSLayout root_child2.FlexGrow = 1f; root_child2.Height = 10f; root.Insert(2, root_child2); - root.StyleDirection = CSSDirection.LTR; + root.StyleDirection = YogaDirection.LTR; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -777,7 +777,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(100f, root_child2.LayoutWidth); Assert.AreEqual(24f, root_child2.LayoutHeight); - root.StyleDirection = CSSDirection.RTL; + root.StyleDirection = YogaDirection.RTL; root.CalculateLayout(); Assert.AreEqual(0f, root.LayoutX); @@ -800,7 +800,7 @@ namespace Facebook.CSSLayout Assert.AreEqual(100f, root_child2.LayoutWidth); Assert.AreEqual(24f, root_child2.LayoutHeight); - CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, false); + CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false); } } diff --git a/csharp/tests/Facebook.CSSLayout/CSSNodeCreateTest.cs b/csharp/tests/Facebook.CSSLayout/CSSNodeCreateTest.cs index 96481d0f..e2e8363d 100644 --- a/csharp/tests/Facebook.CSSLayout/CSSNodeCreateTest.cs +++ b/csharp/tests/Facebook.CSSLayout/CSSNodeCreateTest.cs @@ -22,8 +22,8 @@ namespace Facebook.CSSLayout public void TestSimple() { CSSNode nodeDefault = new CSSNode(); - CSSNode nodeCreated = CSSNode.Create(flexDirection: CSSFlexDirection.Row); - Assert.AreEqual(CSSFlexDirection.Row, nodeCreated.FlexDirection); + CSSNode nodeCreated = CSSNode.Create(flexDirection: YogaFlexDirection.Row); + Assert.AreEqual(YogaFlexDirection.Row, nodeCreated.FlexDirection); Assert.IsFalse(nodeDefault.IsDirty); nodeDefault.CopyStyle(nodeCreated); Assert.IsTrue(nodeDefault.IsDirty); @@ -43,39 +43,39 @@ namespace Facebook.CSSLayout public void TestMultiple() { CSSNode node = CSSNode.Create( - positionType: CSSPositionType.Absolute, - wrap: CSSWrap.Wrap, + positionType: YogaPositionType.Absolute, + wrap: YogaWrap.Wrap, position: new Spacing(top:6, right:4), margin: new Spacing(bottom:5, left:3)); - Assert.AreEqual(CSSFlexDirection.Column, node.FlexDirection); - Assert.AreEqual(CSSPositionType.Absolute, node.PositionType); - Assert.AreEqual(CSSWrap.Wrap, node.Wrap); - Assert.AreEqual(6, node.GetPosition(CSSEdge.Top)); - Assert.IsTrue(CSSConstants.IsUndefined(node.GetPosition(CSSEdge.Bottom))); - Assert.AreEqual(4, node.GetPosition(CSSEdge.Right)); - Assert.IsTrue(CSSConstants.IsUndefined(node.GetPosition(CSSEdge.Left))); - Assert.AreEqual(0, node.GetMargin(CSSEdge.Top)); - Assert.AreEqual(5, node.GetMargin(CSSEdge.Bottom)); - Assert.AreEqual(3, node.GetMargin(CSSEdge.Left)); - Assert.AreEqual(0, node.GetMargin(CSSEdge.Right)); + Assert.AreEqual(YogaFlexDirection.Column, node.FlexDirection); + Assert.AreEqual(YogaPositionType.Absolute, node.PositionType); + Assert.AreEqual(YogaWrap.Wrap, node.Wrap); + Assert.AreEqual(6, node.GetPosition(YogaEdge.Top)); + Assert.IsTrue(YogaConstants.IsUndefined(node.GetPosition(YogaEdge.Bottom))); + Assert.AreEqual(4, node.GetPosition(YogaEdge.Right)); + Assert.IsTrue(YogaConstants.IsUndefined(node.GetPosition(YogaEdge.Left))); + Assert.AreEqual(0, node.GetMargin(YogaEdge.Top)); + Assert.AreEqual(5, node.GetMargin(YogaEdge.Bottom)); + Assert.AreEqual(3, node.GetMargin(YogaEdge.Left)); + Assert.AreEqual(0, node.GetMargin(YogaEdge.Right)); } [Test] public void TestFull() { CSSNode node = CSSNode.Create( - styleDirection: CSSDirection.RTL, - flexDirection: CSSFlexDirection.RowReverse, + styleDirection: YogaDirection.RTL, + flexDirection: YogaFlexDirection.RowReverse, - justifyContent: CSSJustify.SpaceAround, - alignContent: CSSAlign.Center, - alignItems: CSSAlign.FlexEnd, - alignSelf: CSSAlign.Stretch, + justifyContent: YogaJustify.SpaceAround, + alignContent: YogaAlign.Center, + alignItems: YogaAlign.FlexEnd, + alignSelf: YogaAlign.Stretch, - positionType: CSSPositionType.Absolute, - wrap: CSSWrap.Wrap, - overflow: CSSOverflow.Scroll, + positionType: YogaPositionType.Absolute, + wrap: YogaWrap.Wrap, + overflow: YogaOverflow.Scroll, flex: 1, flexGrow: 2, @@ -94,43 +94,43 @@ namespace Facebook.CSSLayout maxWidth: 25, maxHeight: 26); - Assert.AreEqual(CSSDirection.RTL, node.StyleDirection); - Assert.AreEqual(CSSFlexDirection.RowReverse, node.FlexDirection); + Assert.AreEqual(YogaDirection.RTL, node.StyleDirection); + Assert.AreEqual(YogaFlexDirection.RowReverse, node.FlexDirection); - Assert.AreEqual(CSSJustify.SpaceAround, node.JustifyContent); - Assert.AreEqual(CSSAlign.Center, node.AlignContent); - Assert.AreEqual(CSSAlign.FlexEnd, node.AlignItems); - Assert.AreEqual(CSSAlign.Stretch, node.AlignSelf); + Assert.AreEqual(YogaJustify.SpaceAround, node.JustifyContent); + Assert.AreEqual(YogaAlign.Center, node.AlignContent); + Assert.AreEqual(YogaAlign.FlexEnd, node.AlignItems); + Assert.AreEqual(YogaAlign.Stretch, node.AlignSelf); - Assert.AreEqual(CSSPositionType.Absolute, node.PositionType); - Assert.AreEqual(CSSWrap.Wrap, node.Wrap); - Assert.AreEqual(CSSOverflow.Scroll, node.Overflow); + Assert.AreEqual(YogaPositionType.Absolute, node.PositionType); + Assert.AreEqual(YogaWrap.Wrap, node.Wrap); + Assert.AreEqual(YogaOverflow.Scroll, node.Overflow); Assert.AreEqual(2, node.FlexGrow); Assert.AreEqual(3, node.FlexShrink); Assert.AreEqual(4, node.FlexBasis); - node.FlexGrow = CSSConstants.Undefined; + node.FlexGrow = YogaConstants.Undefined; Assert.AreEqual(1, node.FlexGrow); - Assert.AreEqual(5, node.GetPosition(CSSEdge.Top)); - Assert.AreEqual(6, node.GetPosition(CSSEdge.Bottom)); - Assert.AreEqual(7, node.GetPosition(CSSEdge.Left)); - Assert.AreEqual(8, node.GetPosition(CSSEdge.Right)); + Assert.AreEqual(5, node.GetPosition(YogaEdge.Top)); + Assert.AreEqual(6, node.GetPosition(YogaEdge.Bottom)); + Assert.AreEqual(7, node.GetPosition(YogaEdge.Left)); + Assert.AreEqual(8, node.GetPosition(YogaEdge.Right)); - Assert.AreEqual(9, node.GetMargin(CSSEdge.Top)); - Assert.AreEqual(10, node.GetMargin(CSSEdge.Bottom)); - Assert.AreEqual(11, node.GetMargin(CSSEdge.Left)); - Assert.AreEqual(12, node.GetMargin(CSSEdge.Right)); + Assert.AreEqual(9, node.GetMargin(YogaEdge.Top)); + Assert.AreEqual(10, node.GetMargin(YogaEdge.Bottom)); + Assert.AreEqual(11, node.GetMargin(YogaEdge.Left)); + Assert.AreEqual(12, node.GetMargin(YogaEdge.Right)); - Assert.AreEqual(13, node.GetPadding(CSSEdge.Top)); - Assert.AreEqual(14, node.GetPadding(CSSEdge.Bottom)); - Assert.AreEqual(15, node.GetPadding(CSSEdge.Left)); - Assert.AreEqual(16, node.GetPadding(CSSEdge.Right)); + Assert.AreEqual(13, node.GetPadding(YogaEdge.Top)); + Assert.AreEqual(14, node.GetPadding(YogaEdge.Bottom)); + Assert.AreEqual(15, node.GetPadding(YogaEdge.Left)); + Assert.AreEqual(16, node.GetPadding(YogaEdge.Right)); - Assert.AreEqual(17, node.GetBorder(CSSEdge.Top)); - Assert.AreEqual(18, node.GetBorder(CSSEdge.Bottom)); - Assert.AreEqual(19, node.GetBorder(CSSEdge.Left)); - Assert.AreEqual(20, node.GetBorder(CSSEdge.Right)); + Assert.AreEqual(17, node.GetBorder(YogaEdge.Top)); + Assert.AreEqual(18, node.GetBorder(YogaEdge.Bottom)); + Assert.AreEqual(19, node.GetBorder(YogaEdge.Left)); + Assert.AreEqual(20, node.GetBorder(YogaEdge.Right)); Assert.AreEqual(21, node.Width); Assert.AreEqual(22, node.Height); diff --git a/csharp/tests/Facebook.CSSLayout/CSSNodeTest.cs b/csharp/tests/Facebook.CSSLayout/CSSNodeTest.cs index b56c6d43..42e83d39 100644 --- a/csharp/tests/Facebook.CSSLayout/CSSNodeTest.cs +++ b/csharp/tests/Facebook.CSSLayout/CSSNodeTest.cs @@ -219,7 +219,7 @@ namespace Facebook.CSSLayout public void TestCopyStyle() { CSSNode node0 = new CSSNode(); - Assert.IsTrue(CSSConstants.IsUndefined(node0.MaxHeight)); + Assert.IsTrue(YogaConstants.IsUndefined(node0.MaxHeight)); CSSNode node1 = new CSSNode(); node1.MaxHeight = 100; diff --git a/enums.py b/enums.py index 22e1b0ff..e54e49d6 100644 --- a/enums.py +++ b/enums.py @@ -12,54 +12,54 @@ from __future__ import unicode_literals import os ENUMS = { - 'CSSDirection': [ + 'Direction': [ 'Inherit', 'LTR', 'RTL', ], - 'CSSFlexDirection': [ + 'FlexDirection': [ 'Column', 'ColumnReverse', 'Row', 'RowReverse', ], - 'CSSJustify': [ + 'Justify': [ 'FlexStart', 'Center', 'FlexEnd', 'SpaceBetween', 'SpaceAround', ], - 'CSSOverflow': [ + 'Overflow': [ 'Visible', 'Hidden', 'Scroll', ], - 'CSSAlign': [ + 'Align': [ 'Auto', 'FlexStart', 'Center', 'FlexEnd', 'Stretch', ], - 'CSSPositionType': [ + 'PositionType': [ 'Relative', 'Absolute', ], - 'CSSWrap': [ + 'Wrap': [ 'NoWrap', 'Wrap', ], - 'CSSMeasureMode': [ + 'MeasureMode': [ 'Undefined', 'Exactly', 'AtMost', ], - 'CSSDimension': [ + 'Dimension': [ 'Width', 'Height', ], - 'CSSEdge': [ + 'Edge': [ 'Left', 'Top', 'Right', @@ -70,19 +70,19 @@ ENUMS = { 'Vertical', 'All', ], - 'CSSLogLevel': [ + 'LogLevel': [ 'Error', 'Warn', 'Info', 'Debug', 'Verbose', ], - 'CSSExperimentalFeature': [ + 'ExperimentalFeature': [ 'Rounding', # Mimic web flex-basis behavior. 'WebFlexBasis', ], - 'CSSPrintOptions': [ + 'PrintOptions': [ ('Layout', 1), ('Style', 2), ('Children', 4), @@ -118,26 +118,26 @@ with open(root + '/CSSLayout/CSSEnums.h', 'w') as f: f.write(LICENSE) remaining = len(ENUMS) for name, values in ENUMS.items(): - f.write('typedef enum %s {\n' % name) + f.write('typedef enum YG%s {\n' % name) for value in values: if isinstance(value, tuple): - f.write(' %s%s = %d,\n' % (name, value[0], value[1])) + f.write(' YG%s%s = %d,\n' % (name, value[0], value[1])) else: - f.write(' %s%s,\n' % (name, value)) - f.write(' %sCount,\n' % name) - f.write('} %s;\n' % name) + f.write(' YG%s%s,\n' % (name, value)) + f.write(' YG%sCount,\n' % name) + f.write('} YG%s;\n' % name) if remaining > 1: f.write('\n') remaining = remaining - 1 # write out java files for name, values in ENUMS.items(): - with open(root + '/java/com/facebook/csslayout/%s.java' % name, 'w') as f: + with open(root + '/java/com/facebook/csslayout/Yoga%s.java' % name, 'w') as f: f.write(LICENSE) f.write('package com.facebook.csslayout;\n\n') f.write('import com.facebook.proguard.annotations.DoNotStrip;\n\n') f.write('@DoNotStrip\n') - f.write('public enum %s {\n' % name) + f.write('public enum Yoga%s {\n' % name) if len(values) > 0: for value in values: if isinstance(value, tuple): @@ -153,7 +153,7 @@ for name, values in ENUMS.items(): f.write('\n') f.write(' private int mIntValue;\n') f.write('\n') - f.write(' %s(int intValue) {\n' % name) + f.write(' Yoga%s(int intValue) {\n' % name) f.write(' mIntValue = intValue;\n') f.write(' }\n') f.write('\n') @@ -161,7 +161,7 @@ for name, values in ENUMS.items(): f.write(' return mIntValue;\n') f.write(' }\n') f.write('\n') - f.write(' public static %s fromInt(int value) {\n' % name) + f.write(' public static Yoga%s fromInt(int value) {\n' % name) f.write(' switch (value) {\n') for value in values: if isinstance(value, tuple): @@ -175,10 +175,10 @@ for name, values in ENUMS.items(): # write out csharp files for name, values in ENUMS.items(): - with open(root + '/csharp/Facebook.CSSLayout/%s.cs' % name, 'w') as f: + with open(root + '/csharp/Facebook.CSSLayout/Yoga%s.cs' % name, 'w') as f: f.write(LICENSE) f.write('namespace Facebook.CSSLayout\n{\n') - f.write(' public enum %s\n {\n' % name) + f.write(' public enum Yoga%s\n {\n' % name) for value in values: if isinstance(value, tuple): f.write(' %s = %d,\n' % (value[0], value[1])) diff --git a/gentest/gentest-cpp.js b/gentest/gentest-cpp.js index fe655a7c..1d98f7df 100644 --- a/gentest/gentest-cpp.js +++ b/gentest/gentest-cpp.js @@ -32,7 +32,7 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, { if (experiments.length > 0) { for (var i in experiments) { - this.push('CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeature' + experiments[i] +', true);'); + this.push('CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeature' + experiments[i] +', true);'); } this.push(''); } @@ -51,7 +51,7 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, { if (experiments.length > 0) { this.push(''); for (var i in experiments) { - this.push('CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeature' + experiments[i] +', false);'); + this.push('CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeature' + experiments[i] +', false);'); } } @@ -69,47 +69,47 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, { this.push('ASSERT_FLOAT_EQ(' + toFloatString(v0) + ', ' + v1 + ');'); }}, - CSSAlignAuto:{value:'CSSAlignAuto'}, - CSSAlignCenter:{value:'CSSAlignCenter'}, - CSSAlignFlexEnd:{value:'CSSAlignFlexEnd'}, - CSSAlignFlexStart:{value:'CSSAlignFlexStart'}, - CSSAlignStretch:{value:'CSSAlignStretch'}, + YGAlignAuto:{value:'YGAlignAuto'}, + YGAlignCenter:{value:'YGAlignCenter'}, + YGAlignFlexEnd:{value:'YGAlignFlexEnd'}, + YGAlignFlexStart:{value:'YGAlignFlexStart'}, + YGAlignStretch:{value:'YGAlignStretch'}, - CSSDirectionInherit:{value:'CSSDirectionInherit'}, - CSSDirectionLTR:{value:'CSSDirectionLTR'}, - CSSDirectionRTL:{value:'CSSDirectionRTL'}, + YGDirectionInherit:{value:'YGDirectionInherit'}, + YGDirectionLTR:{value:'YGDirectionLTR'}, + YGDirectionRTL:{value:'YGDirectionRTL'}, - CSSEdgeBottom:{value:'CSSEdgeBottom'}, - CSSEdgeEnd:{value:'CSSEdgeEnd'}, - CSSEdgeLeft:{value:'CSSEdgeLeft'}, - CSSEdgeRight:{value:'CSSEdgeRight'}, - CSSEdgeStart:{value:'CSSEdgeStart'}, - CSSEdgeTop:{value:'CSSEdgeTop'}, + YGEdgeBottom:{value:'YGEdgeBottom'}, + YGEdgeEnd:{value:'YGEdgeEnd'}, + YGEdgeLeft:{value:'YGEdgeLeft'}, + YGEdgeRight:{value:'YGEdgeRight'}, + YGEdgeStart:{value:'YGEdgeStart'}, + YGEdgeTop:{value:'YGEdgeTop'}, - CSSFlexDirectionColumn:{value:'CSSFlexDirectionColumn'}, - CSSFlexDirectionColumnReverse:{value:'CSSFlexDirectionColumnReverse'}, - CSSFlexDirectionRow:{value:'CSSFlexDirectionRow'}, - CSSFlexDirectionRowReverse:{value:'CSSFlexDirectionRowReverse'}, + YGFlexDirectionColumn:{value:'YGFlexDirectionColumn'}, + YGFlexDirectionColumnReverse:{value:'YGFlexDirectionColumnReverse'}, + YGFlexDirectionRow:{value:'YGFlexDirectionRow'}, + YGFlexDirectionRowReverse:{value:'YGFlexDirectionRowReverse'}, - CSSJustifyCenter:{value:'CSSJustifyCenter'}, - CSSJustifyFlexEnd:{value:'CSSJustifyFlexEnd'}, - CSSJustifyFlexStart:{value:'CSSJustifyFlexStart'}, - CSSJustifySpaceAround:{value:'CSSJustifySpaceAround'}, - CSSJustifySpaceBetween:{value:'CSSJustifySpaceBetween'}, + YGJustifyCenter:{value:'YGJustifyCenter'}, + YGJustifyFlexEnd:{value:'YGJustifyFlexEnd'}, + YGJustifyFlexStart:{value:'YGJustifyFlexStart'}, + YGJustifySpaceAround:{value:'YGJustifySpaceAround'}, + YGJustifySpaceBetween:{value:'YGJustifySpaceBetween'}, - CSSOverflowHidden:{value:'CSSOverflowHidden'}, - CSSOverflowVisible:{value:'CSSOverflowVisible'}, + YGOverflowHidden:{value:'YGOverflowHidden'}, + YGOverflowVisible:{value:'YGOverflowVisible'}, - CSSPositionTypeAbsolute:{value:'CSSPositionTypeAbsolute'}, - CSSPositionTypeRelative:{value:'CSSPositionTypeRelative'}, + YGPositionTypeAbsolute:{value:'YGPositionTypeAbsolute'}, + YGPositionTypeRelative:{value:'YGPositionTypeRelative'}, - CSSWrapNoWrap:{value:'CSSWrapNoWrap'}, - CSSWrapWrap:{value:'CSSWrapWrap'}, + YGWrapNoWrap:{value:'YGWrapNoWrap'}, + YGWrapWrap:{value:'YGWrapWrap'}, - CSSUndefined:{value:'CSSUndefined'}, + YGUndefined:{value:'YGUndefined'}, CSSNodeCalculateLayout:{value:function(node, dir) { - this.push('CSSNodeCalculateLayout(' + node + ', CSSUndefined, CSSUndefined, ' + dir + ');'); + this.push('CSSNodeCalculateLayout(' + node + ', YGUndefined, YGUndefined, ' + dir + ');'); }}, CSSNodeInsertChild:{value:function(parentName, nodeName, index) { diff --git a/gentest/gentest-cs.js b/gentest/gentest-cs.js index 4ceb2a2f..49c8e7cd 100644 --- a/gentest/gentest-cs.js +++ b/gentest/gentest-cs.js @@ -39,7 +39,7 @@ CSEmitter.prototype = Object.create(Emitter.prototype, { if (experiments.length > 0) { for (var i in experiments) { - this.push('CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.' + experiments[i] +', true);'); + this.push('CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.' + experiments[i] +', true);'); } this.push(''); } @@ -53,7 +53,7 @@ CSEmitter.prototype = Object.create(Emitter.prototype, { if (experiments.length > 0) { this.push(''); for (var i in experiments) { - this.push('CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.' + experiments[i] +', false);'); + this.push('CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.' + experiments[i] +', false);'); } } @@ -78,44 +78,44 @@ CSEmitter.prototype = Object.create(Emitter.prototype, { this.push('Assert.AreEqual(' + v0 + 'f, ' + v1 + ');'); }}, - CSSAlignAuto:{value:'CSSAlign.Auto'}, - CSSAlignCenter:{value:'CSSAlign.Center'}, - CSSAlignFlexEnd:{value:'CSSAlign.FlexEnd'}, - CSSAlignFlexStart:{value:'CSSAlign.FlexStart'}, - CSSAlignStretch:{value:'CSSAlign.Stretch'}, + YGAlignAuto:{value:'YogaAlign.Auto'}, + YGAlignCenter:{value:'YogaAlign.Center'}, + YGAlignFlexEnd:{value:'YogaAlign.FlexEnd'}, + YGAlignFlexStart:{value:'YogaAlign.FlexStart'}, + YGAlignStretch:{value:'YogaAlign.Stretch'}, - CSSDirectionInherit:{value:'CSSDirection.Inherit'}, - CSSDirectionLTR:{value:'CSSDirection.LTR'}, - CSSDirectionRTL:{value:'CSSDirection.RTL'}, + YGDirectionInherit:{value:'YogaDirection.Inherit'}, + YGDirectionLTR:{value:'YogaDirection.LTR'}, + YGDirectionRTL:{value:'YogaDirection.RTL'}, - CSSEdgeBottom:{value:'CSSEdge.Bottom'}, - CSSEdgeEnd:{value:'CSSEdge.End'}, - CSSEdgeLeft:{value:'CSSEdge.Left'}, - CSSEdgeRight:{value:'CSSEdge.Right'}, - CSSEdgeStart:{value:'CSSEdge.Start'}, - CSSEdgeTop:{value:'CSSEdge.Top'}, + YGEdgeBottom:{value:'YogaEdge.Bottom'}, + YGEdgeEnd:{value:'YogaEdge.End'}, + YGEdgeLeft:{value:'YogaEdge.Left'}, + YGEdgeRight:{value:'YogaEdge.Right'}, + YGEdgeStart:{value:'YogaEdge.Start'}, + YGEdgeTop:{value:'YogaEdge.Top'}, - CSSFlexDirectionColumn:{value:'CSSFlexDirection.Column'}, - CSSFlexDirectionColumnReverse:{value:'CSSFlexDirection.ColumnReverse'}, - CSSFlexDirectionRow:{value:'CSSFlexDirection.Row'}, - CSSFlexDirectionRowReverse:{value:'CSSFlexDirection.RowReverse'}, + YGFlexDirectionColumn:{value:'YogaFlexDirection.Column'}, + YGFlexDirectionColumnReverse:{value:'YogaFlexDirection.ColumnReverse'}, + YGFlexDirectionRow:{value:'YogaFlexDirection.Row'}, + YGFlexDirectionRowReverse:{value:'YogaFlexDirection.RowReverse'}, - CSSJustifyCenter:{value:'CSSJustify.Center'}, - CSSJustifyFlexEnd:{value:'CSSJustify.FlexEnd'}, - CSSJustifyFlexStart:{value:'CSSJustify.FlexStart'}, - CSSJustifySpaceAround:{value:'CSSJustify.SpaceAround'}, - CSSJustifySpaceBetween:{value:'CSSJustify.SpaceBetween'}, + YGJustifyCenter:{value:'YogaJustify.Center'}, + YGJustifyFlexEnd:{value:'YogaJustify.FlexEnd'}, + YGJustifyFlexStart:{value:'YogaJustify.FlexStart'}, + YGJustifySpaceAround:{value:'YogaJustify.SpaceAround'}, + YGJustifySpaceBetween:{value:'YogaJustify.SpaceBetween'}, - CSSOverflowHidden:{value:'CSSOverflow.Hidden'}, - CSSOverflowVisible:{value:'CSSOverflow.Visible'}, + YGOverflowHidden:{value:'YogaOverflow.Hidden'}, + YGOverflowVisible:{value:'YogaOverflow.Visible'}, - CSSPositionTypeAbsolute:{value:'CSSPositionType.Absolute'}, - CSSPositionTypeRelative:{value:'CSSPositionType.Relative'}, + YGPositionTypeAbsolute:{value:'YogaPositionType.Absolute'}, + YGPositionTypeRelative:{value:'YogaPositionType.Relative'}, - CSSUndefined:{value:'CSSConstants.Undefined'}, + YGUndefined:{value:'YogaConstants.Undefined'}, - CSSWrapNoWrap:{value:'CSSWrap.NoWrap'}, - CSSWrapWrap:{value:'CSSWrap.Wrap'}, + YGWrapNoWrap:{value:'YogaWrap.NoWrap'}, + YGWrapWrap:{value:'YogaWrap.Wrap'}, CSSNodeCalculateLayout:{value:function(node, dir) { this.push(node + '.StyleDirection = ' + dir + ';'); diff --git a/gentest/gentest-java.js b/gentest/gentest-java.js index 83cc8f24..48b2b82c 100644 --- a/gentest/gentest-java.js +++ b/gentest/gentest-java.js @@ -46,7 +46,7 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, { if (experiments.length > 0) { for (var i in experiments) { - this.push('CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.' + toJavaUpper(experiments[i]) +', true);'); + this.push('CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.' + toJavaUpper(experiments[i]) +', true);'); } this.push(''); } @@ -60,7 +60,7 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, { if (experiments.length > 0) { this.push(''); for (var i in experiments) { - this.push('CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.' + toJavaUpper(experiments[i]) +', false);'); + this.push('CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.' + toJavaUpper(experiments[i]) +', false);'); } } @@ -83,44 +83,44 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, { this.push('assertEquals(' + v0 + 'f, ' + v1 + ', 0.0f);'); }}, - CSSAlignAuto:{value:'CSSAlign.AUTO'}, - CSSAlignCenter:{value:'CSSAlign.CENTER'}, - CSSAlignFlexEnd:{value:'CSSAlign.FLEX_END'}, - CSSAlignFlexStart:{value:'CSSAlign.FLEX_START'}, - CSSAlignStretch:{value:'CSSAlign.STRETCH'}, + YGAlignAuto:{value:'YogaAlign.AUTO'}, + YGAlignCenter:{value:'YogaAlign.CENTER'}, + YGAlignFlexEnd:{value:'YogaAlign.FLEX_END'}, + YGAlignFlexStart:{value:'YogaAlign.FLEX_START'}, + YGAlignStretch:{value:'YogaAlign.STRETCH'}, - CSSDirectionInherit:{value:'CSSDirection.INHERIT'}, - CSSDirectionLTR:{value:'CSSDirection.LTR'}, - CSSDirectionRTL:{value:'CSSDirection.RTL'}, + YGDirectionInherit:{value:'YogaDirection.INHERIT'}, + YGDirectionLTR:{value:'YogaDirection.LTR'}, + YGDirectionRTL:{value:'YogaDirection.RTL'}, - CSSEdgeBottom:{value:'CSSEdge.BOTTOM'}, - CSSEdgeEnd:{value:'CSSEdge.END'}, - CSSEdgeLeft:{value:'CSSEdge.LEFT'}, - CSSEdgeRight:{value:'CSSEdge.RIGHT'}, - CSSEdgeStart:{value:'CSSEdge.START'}, - CSSEdgeTop:{value:'CSSEdge.TOP'}, + YGEdgeBottom:{value:'YogaEdge.BOTTOM'}, + YGEdgeEnd:{value:'YogaEdge.END'}, + YGEdgeLeft:{value:'YogaEdge.LEFT'}, + YGEdgeRight:{value:'YogaEdge.RIGHT'}, + YGEdgeStart:{value:'YogaEdge.START'}, + YGEdgeTop:{value:'YogaEdge.TOP'}, - CSSFlexDirectionColumn:{value:'CSSFlexDirection.COLUMN'}, - CSSFlexDirectionColumnReverse:{value:'CSSFlexDirection.COLUMN_REVERSE'}, - CSSFlexDirectionRow:{value:'CSSFlexDirection.ROW'}, - CSSFlexDirectionRowReverse:{value:'CSSFlexDirection.ROW_REVERSE'}, + YGFlexDirectionColumn:{value:'YogaFlexDirection.COLUMN'}, + YGFlexDirectionColumnReverse:{value:'YogaFlexDirection.COLUMN_REVERSE'}, + YGFlexDirectionRow:{value:'YogaFlexDirection.ROW'}, + YGFlexDirectionRowReverse:{value:'YogaFlexDirection.ROW_REVERSE'}, - CSSJustifyCenter:{value:'CSSJustify.CENTER'}, - CSSJustifyFlexEnd:{value:'CSSJustify.FLEX_END'}, - CSSJustifyFlexStart:{value:'CSSJustify.FLEX_START'}, - CSSJustifySpaceAround:{value:'CSSJustify.SPACE_AROUND'}, - CSSJustifySpaceBetween:{value:'CSSJustify.SPACE_BETWEEN'}, + YGJustifyCenter:{value:'YogaJustify.CENTER'}, + YGJustifyFlexEnd:{value:'YogaJustify.FLEX_END'}, + YGJustifyFlexStart:{value:'YogaJustify.FLEX_START'}, + YGJustifySpaceAround:{value:'YogaJustify.SPACE_AROUND'}, + YGJustifySpaceBetween:{value:'YogaJustify.SPACE_BETWEEN'}, - CSSOverflowHidden:{value:'CSSOverflow.HIDDEN'}, - CSSOverflowVisible:{value:'CSSOverflow.VISIBLE'}, + YGOverflowHidden:{value:'YogaOverflow.HIDDEN'}, + YGOverflowVisible:{value:'YogaOverflow.VISIBLE'}, - CSSPositionTypeAbsolute:{value:'CSSPositionType.ABSOLUTE'}, - CSSPositionTypeRelative:{value:'CSSPositionType.RELATIVE'}, + YGPositionTypeAbsolute:{value:'YogaPositionType.ABSOLUTE'}, + YGPositionTypeRelative:{value:'YogaPositionType.RELATIVE'}, - CSSUndefined:{value:'CSSConstants.UNDEFINED'}, + YGUndefined:{value:'YogaConstants.UNDEFINED'}, - CSSWrapNoWrap:{value:'CSSWrap.NO_WRAP'}, - CSSWrapWrap:{value:'CSSWrap.WRAP'}, + YGWrapNoWrap:{value:'YogaWrap.NO_WRAP'}, + YGWrapWrap:{value:'YogaWrap.WRAP'}, CSSNodeCalculateLayout:{value:function(node, dir) { this.push(node + '.setDirection(' + dir + ');'); diff --git a/gentest/gentest.js b/gentest/gentest.js index 02f44609..ed6fd6b9 100755 --- a/gentest/gentest.js +++ b/gentest/gentest.js @@ -87,13 +87,13 @@ function printTest(e, LTRContainer, RTLContainer, genericContainer) { 'root', null); - e.CSSNodeCalculateLayout('root', e.CSSDirectionLTR); + e.CSSNodeCalculateLayout('root', e.YGDirectionLTR); e.push(''); assertTestTree(e, LTRLayoutTree[i], 'root', null); e.push(''); - e.CSSNodeCalculateLayout('root', e.CSSDirectionRTL); + e.CSSNodeCalculateLayout('root', e.YGDirectionRTL); e.push(''); assertTestTree(e, RTLLayoutTree[i], 'root', null); @@ -119,7 +119,7 @@ function assertTestTree(e, node, nodeName, parentName) { } function checkDefaultValues() { - // Sanity check of the CSSLayout default values by test-template.html + // Sanity check of the Yoga default values by test-template.html [ {style:'flex-direction', value:'column'}, {style:'justify-content', value:'flex-start'}, @@ -198,83 +198,83 @@ function setupTestTree(e, parent, node, genericNode, nodeName, parentName, index break; case 'left': if (genericNode.rawStyle.indexOf('start:') >= 0) { - e.CSSNodeStyleSetPosition(nodeName, e.CSSEdgeStart, pixelValue(e, node.style[style])); + e.CSSNodeStyleSetPosition(nodeName, e.YGEdgeStart, pixelValue(e, node.style[style])); } else { - e.CSSNodeStyleSetPosition(nodeName, e.CSSEdgeLeft, pixelValue(e, node.style[style])); + e.CSSNodeStyleSetPosition(nodeName, e.YGEdgeLeft, pixelValue(e, node.style[style])); } break; case 'top': - e.CSSNodeStyleSetPosition(nodeName, e.CSSEdgeTop, pixelValue(e, node.style[style])); + e.CSSNodeStyleSetPosition(nodeName, e.YGEdgeTop, pixelValue(e, node.style[style])); break; case 'right': if (genericNode.rawStyle.indexOf('end:') >= 0) { - e.CSSNodeStyleSetPosition(nodeName, e.CSSEdgeEnd, pixelValue(e, node.style[style])); + e.CSSNodeStyleSetPosition(nodeName, e.YGEdgeEnd, pixelValue(e, node.style[style])); } else { - e.CSSNodeStyleSetPosition(nodeName, e.CSSEdgeRight, pixelValue(e, node.style[style])); + e.CSSNodeStyleSetPosition(nodeName, e.YGEdgeRight, pixelValue(e, node.style[style])); } break; case 'bottom': - e.CSSNodeStyleSetPosition(nodeName, e.CSSEdgeBottom, pixelValue(e, node.style[style])); + e.CSSNodeStyleSetPosition(nodeName, e.YGEdgeBottom, pixelValue(e, node.style[style])); break; case 'margin-left': if (genericNode.rawStyle.indexOf('margin-start:') >= 0) { - e.CSSNodeStyleSetMargin(nodeName, e.CSSEdgeStart, pixelValue(e, node.style[style])); + e.CSSNodeStyleSetMargin(nodeName, e.YGEdgeStart, pixelValue(e, node.style[style])); } else { - e.CSSNodeStyleSetMargin(nodeName, e.CSSEdgeLeft, pixelValue(e, node.style[style])); + e.CSSNodeStyleSetMargin(nodeName, e.YGEdgeLeft, pixelValue(e, node.style[style])); } break; case 'margin-top': - e.CSSNodeStyleSetMargin(nodeName, e.CSSEdgeTop, pixelValue(e, node.style[style])); + e.CSSNodeStyleSetMargin(nodeName, e.YGEdgeTop, pixelValue(e, node.style[style])); break; case 'margin-right': if (genericNode.rawStyle.indexOf('margin-end:') >= 0) { - e.CSSNodeStyleSetMargin(nodeName, e.CSSEdgeEnd, pixelValue(e, node.style[style])); + e.CSSNodeStyleSetMargin(nodeName, e.YGEdgeEnd, pixelValue(e, node.style[style])); } else { - e.CSSNodeStyleSetMargin(nodeName, e.CSSEdgeRight, pixelValue(e, node.style[style])); + e.CSSNodeStyleSetMargin(nodeName, e.YGEdgeRight, pixelValue(e, node.style[style])); } break; case 'margin-bottom': - e.CSSNodeStyleSetMargin(nodeName, e.CSSEdgeBottom, pixelValue(e, node.style[style])); + e.CSSNodeStyleSetMargin(nodeName, e.YGEdgeBottom, pixelValue(e, node.style[style])); break; case 'padding-left': if (genericNode.rawStyle.indexOf('padding-start:') >= 0) { - e.CSSNodeStyleSetPadding(nodeName, e.CSSEdgeStart, pixelValue(e, node.style[style])); + e.CSSNodeStyleSetPadding(nodeName, e.YGEdgeStart, pixelValue(e, node.style[style])); } else { - e.CSSNodeStyleSetPadding(nodeName, e.CSSEdgeLeft, pixelValue(e, node.style[style])); + e.CSSNodeStyleSetPadding(nodeName, e.YGEdgeLeft, pixelValue(e, node.style[style])); } break; case 'padding-top': - e.CSSNodeStyleSetPadding(nodeName, e.CSSEdgeTop, pixelValue(e, node.style[style])); + e.CSSNodeStyleSetPadding(nodeName, e.YGEdgeTop, pixelValue(e, node.style[style])); break; case 'padding-right': if (genericNode.rawStyle.indexOf('padding-end:') >= 0) { - e.CSSNodeStyleSetPadding(nodeName, e.CSSEdgeEnd, pixelValue(e, node.style[style])); + e.CSSNodeStyleSetPadding(nodeName, e.YGEdgeEnd, pixelValue(e, node.style[style])); } else { - e.CSSNodeStyleSetPadding(nodeName, e.CSSEdgeRight, pixelValue(e, node.style[style])); + e.CSSNodeStyleSetPadding(nodeName, e.YGEdgeRight, pixelValue(e, node.style[style])); } break; case 'padding-bottom': - e.CSSNodeStyleSetPadding(nodeName, e.CSSEdgeBottom, pixelValue(e, node.style[style])); + e.CSSNodeStyleSetPadding(nodeName, e.YGEdgeBottom, pixelValue(e, node.style[style])); break; case 'border-left-width': if (genericNode.rawStyle.indexOf('border-start-width:') >= 0) { - e.CSSNodeStyleSetBorder(nodeName, e.CSSEdgeStart, pixelValue(e, node.style[style])); + e.CSSNodeStyleSetBorder(nodeName, e.YGEdgeStart, pixelValue(e, node.style[style])); } else { - e.CSSNodeStyleSetBorder(nodeName, e.CSSEdgeLeft, pixelValue(e, node.style[style])); + e.CSSNodeStyleSetBorder(nodeName, e.YGEdgeLeft, pixelValue(e, node.style[style])); } break; case 'border-top-width': - e.CSSNodeStyleSetBorder(nodeName, e.CSSEdgeTop, pixelValue(e, node.style[style])); + e.CSSNodeStyleSetBorder(nodeName, e.YGEdgeTop, pixelValue(e, node.style[style])); break; case 'border-right-width': if (genericNode.rawStyle.indexOf('border-end-width:') >= 0) { - e.CSSNodeStyleSetBorder(nodeName, e.CSSEdgeEnd, pixelValue(e, node.style[style])); + e.CSSNodeStyleSetBorder(nodeName, e.YGEdgeEnd, pixelValue(e, node.style[style])); } else { - e.CSSNodeStyleSetBorder(nodeName, e.CSSEdgeRight, pixelValue(e, node.style[style])); + e.CSSNodeStyleSetBorder(nodeName, e.YGEdgeRight, pixelValue(e, node.style[style])); } break; case 'border-bottom-width': - e.CSSNodeStyleSetBorder(nodeName, e.CSSEdgeBottom, pixelValue(e, node.style[style])); + e.CSSNodeStyleSetBorder(nodeName, e.YGEdgeBottom, pixelValue(e, node.style[style])); break; case 'width': e.CSSNodeStyleSetWidth(nodeName, pixelValue(e, node.style[style])); @@ -318,66 +318,66 @@ function setupTestTree(e, parent, node, genericNode, nodeName, parentName, index function overflowValue(e, value) { switch (value) { - case 'visible': return e.CSSOverflowVisible; - case 'hidden': return e.CSSOverflowHidden; + case 'visible': return e.YGOverflowVisible; + case 'hidden': return e.YGOverflowHidden; } } function wrapValue(e, value) { switch (value) { - case 'wrap': return e.CSSWrapWrap; - case 'nowrap': return e.CSSWrapNoWrap; + case 'wrap': return e.YGWrapWrap; + case 'nowrap': return e.YGWrapNoWrap; } } function flexDirectionValue(e, value) { switch (value) { - case 'row': return e.CSSFlexDirectionRow; - case 'row-reverse': return e.CSSFlexDirectionRowReverse; - case 'column': return e.CSSFlexDirectionColumn; - case 'column-reverse': return e.CSSFlexDirectionColumnReverse; + case 'row': return e.YGFlexDirectionRow; + case 'row-reverse': return e.YGFlexDirectionRowReverse; + case 'column': return e.YGFlexDirectionColumn; + case 'column-reverse': return e.YGFlexDirectionColumnReverse; } } function justifyValue(e, value) { switch (value) { - case 'center': return e.CSSJustifyCenter; - case 'space-around': return e.CSSJustifySpaceAround; - case 'space-between': return e.CSSJustifySpaceBetween; - case 'flex-start': return e.CSSJustifyFlexStart; - case 'flex-end': return e.CSSJustifyFlexEnd; + case 'center': return e.YGJustifyCenter; + case 'space-around': return e.YGJustifySpaceAround; + case 'space-between': return e.YGJustifySpaceBetween; + case 'flex-start': return e.YGJustifyFlexStart; + case 'flex-end': return e.YGJustifyFlexEnd; } } function positionValue(e, value) { switch (value) { - case 'absolute': return e.CSSPositionTypeAbsolute; - default: return e.CSSPositionTypeRelative + case 'absolute': return e.YGPositionTypeAbsolute; + default: return e.YGPositionTypeRelative } } function directionValue(e, value) { switch (value) { - case 'ltr': return e.CSSDirectionLTR; - case 'rtl': return e.CSSDirectionRTL; - case 'inherit': return e.CSSDirectionInherit; + case 'ltr': return e.YGDirectionLTR; + case 'rtl': return e.YGDirectionRTL; + case 'inherit': return e.YGDirectionInherit; } } function alignValue(e, value) { switch (value) { - case 'auto': return e.CSSAlignAuto; - case 'center': return e.CSSAlignCenter; - case 'stretch': return e.CSSAlignStretch; - case 'flex-start': return e.CSSAlignFlexStart; - case 'flex-end': return e.CSSAlignFlexEnd; + case 'auto': return e.YGAlignAuto; + case 'center': return e.YGAlignCenter; + case 'stretch': return e.YGAlignStretch; + case 'flex-start': return e.YGAlignFlexStart; + case 'flex-end': return e.YGAlignFlexEnd; } } function pixelValue(e, value) { switch (value) { - case 'auto': return e.CSSUndefined; - case 'undefined': return e.CSSUndefined; + case 'auto': return e.YGUndefined; + case 'undefined': return e.YGUndefined; default: return value.replace('px', ''); } } diff --git a/java/com/facebook/csslayout/CSSLogger.java b/java/com/facebook/csslayout/CSSLogger.java index d270e39f..c751768f 100644 --- a/java/com/facebook/csslayout/CSSLogger.java +++ b/java/com/facebook/csslayout/CSSLogger.java @@ -13,10 +13,10 @@ import com.facebook.proguard.annotations.DoNotStrip; /** * Inteface for recieving logs from native layer. Use by setting CSSNode.setLogger(myLogger); - * See CSSLogLevel for the different log levels. + * See YogaLogLevel for the different log levels. */ @DoNotStrip public interface CSSLogger { @DoNotStrip - void log(CSSLogLevel level, String message); + void log(YogaLogLevel level, String message); } diff --git a/java/com/facebook/csslayout/CSSNode.java b/java/com/facebook/csslayout/CSSNode.java index 47939fe6..1fc2af87 100644 --- a/java/com/facebook/csslayout/CSSNode.java +++ b/java/com/facebook/csslayout/CSSNode.java @@ -39,13 +39,13 @@ public class CSSNode implements CSSNodeAPI { int feature, boolean enabled); public static void setExperimentalFeatureEnabled( - CSSExperimentalFeature feature, + YogaExperimentalFeature feature, boolean enabled) { jni_CSSLayoutSetExperimentalFeatureEnabled(feature.intValue(), enabled); } private static native boolean jni_CSSLayoutIsExperimentalFeatureEnabled(int feature); - public static boolean isExperimentalFeatureEnabled(CSSExperimentalFeature feature) { + public static boolean isExperimentalFeatureEnabled(YogaExperimentalFeature feature) { return jni_CSSLayoutIsExperimentalFeatureEnabled(feature.intValue()); } @@ -61,13 +61,13 @@ public class CSSNode implements CSSNodeAPI { private boolean mHasSetPosition = false; @DoNotStrip - private float mWidth = CSSConstants.UNDEFINED; + private float mWidth = YogaConstants.UNDEFINED; @DoNotStrip - private float mHeight = CSSConstants.UNDEFINED; + private float mHeight = YogaConstants.UNDEFINED; @DoNotStrip - private float mTop = CSSConstants.UNDEFINED; + private float mTop = YogaConstants.UNDEFINED; @DoNotStrip - private float mLeft = CSSConstants.UNDEFINED; + private float mLeft = YogaConstants.UNDEFINED; @DoNotStrip private int mLayoutDirection = 0; @@ -97,10 +97,10 @@ public class CSSNode implements CSSNodeAPI { mHasSetBorder = false; mHasSetPosition = false; - mWidth = CSSConstants.UNDEFINED; - mHeight = CSSConstants.UNDEFINED; - mTop = CSSConstants.UNDEFINED; - mLeft = CSSConstants.UNDEFINED; + mWidth = YogaConstants.UNDEFINED; + mHeight = YogaConstants.UNDEFINED; + mTop = YogaConstants.UNDEFINED; + mLeft = YogaConstants.UNDEFINED; mLayoutDirection = 0; mMeasureFunction = null; @@ -193,103 +193,103 @@ public class CSSNode implements CSSNodeAPI { private native int jni_CSSNodeStyleGetDirection(long nativePointer); @Override - public CSSDirection getStyleDirection() { - return CSSDirection.values()[jni_CSSNodeStyleGetDirection(mNativePointer)]; + public YogaDirection getStyleDirection() { + return YogaDirection.values()[jni_CSSNodeStyleGetDirection(mNativePointer)]; } private native void jni_CSSNodeStyleSetDirection(long nativePointer, int direction); @Override - public void setDirection(CSSDirection direction) { + public void setDirection(YogaDirection direction) { jni_CSSNodeStyleSetDirection(mNativePointer, direction.intValue()); } private native int jni_CSSNodeStyleGetFlexDirection(long nativePointer); @Override - public CSSFlexDirection getFlexDirection() { - return CSSFlexDirection.values()[jni_CSSNodeStyleGetFlexDirection(mNativePointer)]; + public YogaFlexDirection getFlexDirection() { + return YogaFlexDirection.values()[jni_CSSNodeStyleGetFlexDirection(mNativePointer)]; } private native void jni_CSSNodeStyleSetFlexDirection(long nativePointer, int flexDirection); @Override - public void setFlexDirection(CSSFlexDirection flexDirection) { + public void setFlexDirection(YogaFlexDirection flexDirection) { jni_CSSNodeStyleSetFlexDirection(mNativePointer, flexDirection.intValue()); } private native int jni_CSSNodeStyleGetJustifyContent(long nativePointer); @Override - public CSSJustify getJustifyContent() { - return CSSJustify.values()[jni_CSSNodeStyleGetJustifyContent(mNativePointer)]; + public YogaJustify getJustifyContent() { + return YogaJustify.values()[jni_CSSNodeStyleGetJustifyContent(mNativePointer)]; } private native void jni_CSSNodeStyleSetJustifyContent(long nativePointer, int justifyContent); @Override - public void setJustifyContent(CSSJustify justifyContent) { + public void setJustifyContent(YogaJustify justifyContent) { jni_CSSNodeStyleSetJustifyContent(mNativePointer, justifyContent.intValue()); } private native int jni_CSSNodeStyleGetAlignItems(long nativePointer); @Override - public CSSAlign getAlignItems() { - return CSSAlign.values()[jni_CSSNodeStyleGetAlignItems(mNativePointer)]; + public YogaAlign getAlignItems() { + return YogaAlign.values()[jni_CSSNodeStyleGetAlignItems(mNativePointer)]; } private native void jni_CSSNodeStyleSetAlignItems(long nativePointer, int alignItems); @Override - public void setAlignItems(CSSAlign alignItems) { + public void setAlignItems(YogaAlign alignItems) { jni_CSSNodeStyleSetAlignItems(mNativePointer, alignItems.intValue()); } private native int jni_CSSNodeStyleGetAlignSelf(long nativePointer); @Override - public CSSAlign getAlignSelf() { - return CSSAlign.values()[jni_CSSNodeStyleGetAlignSelf(mNativePointer)]; + public YogaAlign getAlignSelf() { + return YogaAlign.values()[jni_CSSNodeStyleGetAlignSelf(mNativePointer)]; } private native void jni_CSSNodeStyleSetAlignSelf(long nativePointer, int alignSelf); @Override - public void setAlignSelf(CSSAlign alignSelf) { + public void setAlignSelf(YogaAlign alignSelf) { jni_CSSNodeStyleSetAlignSelf(mNativePointer, alignSelf.intValue()); } private native int jni_CSSNodeStyleGetAlignContent(long nativePointer); @Override - public CSSAlign getAlignContent() { - return CSSAlign.values()[jni_CSSNodeStyleGetAlignContent(mNativePointer)]; + public YogaAlign getAlignContent() { + return YogaAlign.values()[jni_CSSNodeStyleGetAlignContent(mNativePointer)]; } private native void jni_CSSNodeStyleSetAlignContent(long nativePointer, int alignContent); @Override - public void setAlignContent(CSSAlign alignContent) { + public void setAlignContent(YogaAlign alignContent) { jni_CSSNodeStyleSetAlignContent(mNativePointer, alignContent.intValue()); } private native int jni_CSSNodeStyleGetPositionType(long nativePointer); @Override - public CSSPositionType getPositionType() { - return CSSPositionType.values()[jni_CSSNodeStyleGetPositionType(mNativePointer)]; + public YogaPositionType getPositionType() { + return YogaPositionType.values()[jni_CSSNodeStyleGetPositionType(mNativePointer)]; } private native void jni_CSSNodeStyleSetPositionType(long nativePointer, int positionType); @Override - public void setPositionType(CSSPositionType positionType) { + public void setPositionType(YogaPositionType positionType) { jni_CSSNodeStyleSetPositionType(mNativePointer, positionType.intValue()); } private native void jni_CSSNodeStyleSetFlexWrap(long nativePointer, int wrapType); @Override - public void setWrap(CSSWrap flexWrap) { + public void setWrap(YogaWrap flexWrap) { jni_CSSNodeStyleSetFlexWrap(mNativePointer, flexWrap.intValue()); } private native int jni_CSSNodeStyleGetOverflow(long nativePointer); @Override - public CSSOverflow getOverflow() { - return CSSOverflow.values()[jni_CSSNodeStyleGetOverflow(mNativePointer)]; + public YogaOverflow getOverflow() { + return YogaOverflow.values()[jni_CSSNodeStyleGetOverflow(mNativePointer)]; } private native void jni_CSSNodeStyleSetOverflow(long nativePointer, int overflow); @Override - public void setOverflow(CSSOverflow overflow) { + public void setOverflow(YogaOverflow overflow) { jni_CSSNodeStyleSetOverflow(mNativePointer, overflow.intValue()); } @@ -337,64 +337,64 @@ public class CSSNode implements CSSNodeAPI { private native float jni_CSSNodeStyleGetMargin(long nativePointer, int edge); @Override - public float getMargin(CSSEdge edge) { + public float getMargin(YogaEdge edge) { if (!mHasSetMargin) { - return edge.intValue() < CSSEdge.START.intValue() ? 0 : CSSConstants.UNDEFINED; + return edge.intValue() < YogaEdge.START.intValue() ? 0 : YogaConstants.UNDEFINED; } return jni_CSSNodeStyleGetMargin(mNativePointer, edge.intValue()); } private native void jni_CSSNodeStyleSetMargin(long nativePointer, int edge, float margin); @Override - public void setMargin(CSSEdge edge, float margin) { + public void setMargin(YogaEdge edge, float margin) { mHasSetMargin = true; jni_CSSNodeStyleSetMargin(mNativePointer, edge.intValue(), margin); } private native float jni_CSSNodeStyleGetPadding(long nativePointer, int edge); @Override - public float getPadding(CSSEdge edge) { + public float getPadding(YogaEdge edge) { if (!mHasSetPadding) { - return edge.intValue() < CSSEdge.START.intValue() ? 0 : CSSConstants.UNDEFINED; + return edge.intValue() < YogaEdge.START.intValue() ? 0 : YogaConstants.UNDEFINED; } return jni_CSSNodeStyleGetPadding(mNativePointer, edge.intValue()); } private native void jni_CSSNodeStyleSetPadding(long nativePointer, int edge, float padding); @Override - public void setPadding(CSSEdge edge, float padding) { + public void setPadding(YogaEdge edge, float padding) { mHasSetPadding = true; jni_CSSNodeStyleSetPadding(mNativePointer, edge.intValue(), padding); } private native float jni_CSSNodeStyleGetBorder(long nativePointer, int edge); @Override - public float getBorder(CSSEdge edge) { + public float getBorder(YogaEdge edge) { if (!mHasSetBorder) { - return edge.intValue() < CSSEdge.START.intValue() ? 0 : CSSConstants.UNDEFINED; + return edge.intValue() < YogaEdge.START.intValue() ? 0 : YogaConstants.UNDEFINED; } return jni_CSSNodeStyleGetBorder(mNativePointer, edge.intValue()); } private native void jni_CSSNodeStyleSetBorder(long nativePointer, int edge, float border); @Override - public void setBorder(CSSEdge edge, float border) { + public void setBorder(YogaEdge edge, float border) { mHasSetBorder = true; jni_CSSNodeStyleSetBorder(mNativePointer, edge.intValue(), border); } private native float jni_CSSNodeStyleGetPosition(long nativePointer, int edge); @Override - public float getPosition(CSSEdge edge) { + public float getPosition(YogaEdge edge) { if (!mHasSetPosition) { - return CSSConstants.UNDEFINED; + return YogaConstants.UNDEFINED; } return jni_CSSNodeStyleGetPosition(mNativePointer, edge.intValue()); } private native void jni_CSSNodeStyleSetPosition(long nativePointer, int edge, float position); @Override - public void setPosition(CSSEdge edge, float position) { + public void setPosition(YogaEdge edge, float position) { mHasSetPosition = true; jni_CSSNodeStyleSetPosition(mNativePointer, edge.intValue(), position); } @@ -502,8 +502,8 @@ public class CSSNode implements CSSNodeAPI { } @Override - public CSSDirection getLayoutDirection() { - return CSSDirection.values()[mLayoutDirection]; + public YogaDirection getLayoutDirection() { + return YogaDirection.values()[mLayoutDirection]; } private native void jni_CSSNodeSetHasMeasureFunc(long nativePointer, boolean hasMeasureFunc); @@ -527,9 +527,9 @@ public class CSSNode implements CSSNodeAPI { return mMeasureFunction.measure( this, width, - CSSMeasureMode.values()[widthMode], + YogaMeasureMode.values()[widthMode], height, - CSSMeasureMode.values()[heightMode]); + YogaMeasureMode.values()[heightMode]); } @Override diff --git a/java/com/facebook/csslayout/CSSNodeAPI.java b/java/com/facebook/csslayout/CSSNodeAPI.java index 8e5d19d5..3c13015a 100644 --- a/java/com/facebook/csslayout/CSSNodeAPI.java +++ b/java/com/facebook/csslayout/CSSNodeAPI.java @@ -18,9 +18,9 @@ public interface CSSNodeAPI { long measure( CSSNodeAPI node, float width, - CSSMeasureMode widthMode, + YogaMeasureMode widthMode, float height, - CSSMeasureMode heightMode); + YogaMeasureMode heightMode); } int getChildCount(); @@ -37,21 +37,21 @@ public interface CSSNodeAPI { void dirty(); void markLayoutSeen(); void copyStyle(CSSNodeType srcNode); - CSSDirection getStyleDirection(); - void setDirection(CSSDirection direction); - CSSFlexDirection getFlexDirection(); - void setFlexDirection(CSSFlexDirection flexDirection); - CSSJustify getJustifyContent(); - void setJustifyContent(CSSJustify justifyContent); - CSSAlign getAlignItems(); - void setAlignItems(CSSAlign alignItems); - CSSAlign getAlignSelf(); - void setAlignSelf(CSSAlign alignSelf); - CSSAlign getAlignContent(); - void setAlignContent(CSSAlign alignContent); - CSSPositionType getPositionType(); - void setPositionType(CSSPositionType positionType); - void setWrap(CSSWrap flexWrap); + YogaDirection getStyleDirection(); + void setDirection(YogaDirection direction); + YogaFlexDirection getFlexDirection(); + void setFlexDirection(YogaFlexDirection flexDirection); + YogaJustify getJustifyContent(); + void setJustifyContent(YogaJustify justifyContent); + YogaAlign getAlignItems(); + void setAlignItems(YogaAlign alignItems); + YogaAlign getAlignSelf(); + void setAlignSelf(YogaAlign alignSelf); + YogaAlign getAlignContent(); + void setAlignContent(YogaAlign alignContent); + YogaPositionType getPositionType(); + void setPositionType(YogaPositionType positionType); + void setWrap(YogaWrap flexWrap); void setFlex(float flex); float getFlexGrow(); void setFlexGrow(float flexGrow); @@ -59,14 +59,14 @@ public interface CSSNodeAPI { void setFlexShrink(float flexShrink); float getFlexBasis(); void setFlexBasis(float flexBasis); - float getMargin(CSSEdge edge); - void setMargin(CSSEdge edge, float margin); - float getPadding(CSSEdge edge); - void setPadding(CSSEdge edge, float padding); - float getBorder(CSSEdge edge); - void setBorder(CSSEdge edge, float border); - float getPosition(CSSEdge edge); - void setPosition(CSSEdge edge, float position); + float getMargin(YogaEdge edge); + void setMargin(YogaEdge edge, float margin); + float getPadding(YogaEdge edge); + void setPadding(YogaEdge edge, float padding); + float getBorder(YogaEdge edge); + void setBorder(YogaEdge edge, float border); + float getPosition(YogaEdge edge); + void setPosition(YogaEdge edge, float position); float getWidth(); void setWidth(float width); float getHeight(); @@ -83,9 +83,9 @@ public interface CSSNodeAPI { float getLayoutY(); float getLayoutWidth(); float getLayoutHeight(); - CSSDirection getLayoutDirection(); - CSSOverflow getOverflow(); - void setOverflow(CSSOverflow overflow); + YogaDirection getLayoutDirection(); + YogaOverflow getOverflow(); + void setOverflow(YogaOverflow overflow); void setData(Object data); Object getData(); void reset(); diff --git a/java/com/facebook/csslayout/CSSAlign.java b/java/com/facebook/csslayout/YogaAlign.java similarity index 89% rename from java/com/facebook/csslayout/CSSAlign.java rename to java/com/facebook/csslayout/YogaAlign.java index 4f4af8cb..0ad38450 100644 --- a/java/com/facebook/csslayout/CSSAlign.java +++ b/java/com/facebook/csslayout/YogaAlign.java @@ -12,7 +12,7 @@ package com.facebook.csslayout; import com.facebook.proguard.annotations.DoNotStrip; @DoNotStrip -public enum CSSAlign { +public enum YogaAlign { AUTO(0), FLEX_START(1), CENTER(2), @@ -21,7 +21,7 @@ public enum CSSAlign { private int mIntValue; - CSSAlign(int intValue) { + YogaAlign(int intValue) { mIntValue = intValue; } @@ -29,7 +29,7 @@ public enum CSSAlign { return mIntValue; } - public static CSSAlign fromInt(int value) { + public static YogaAlign fromInt(int value) { switch (value) { case 0: return AUTO; case 1: return FLEX_START; diff --git a/java/com/facebook/csslayout/CSSConstants.java b/java/com/facebook/csslayout/YogaConstants.java similarity index 94% rename from java/com/facebook/csslayout/CSSConstants.java rename to java/com/facebook/csslayout/YogaConstants.java index 01a0d597..03db3feb 100644 --- a/java/com/facebook/csslayout/CSSConstants.java +++ b/java/com/facebook/csslayout/YogaConstants.java @@ -9,7 +9,7 @@ package com.facebook.csslayout; -public class CSSConstants { +public class YogaConstants { public static final float UNDEFINED = Float.NaN; diff --git a/java/com/facebook/csslayout/CSSDimension.java b/java/com/facebook/csslayout/YogaDimension.java similarity index 86% rename from java/com/facebook/csslayout/CSSDimension.java rename to java/com/facebook/csslayout/YogaDimension.java index 77785ea6..a73f49c8 100644 --- a/java/com/facebook/csslayout/CSSDimension.java +++ b/java/com/facebook/csslayout/YogaDimension.java @@ -12,13 +12,13 @@ package com.facebook.csslayout; import com.facebook.proguard.annotations.DoNotStrip; @DoNotStrip -public enum CSSDimension { +public enum YogaDimension { WIDTH(0), HEIGHT(1); private int mIntValue; - CSSDimension(int intValue) { + YogaDimension(int intValue) { mIntValue = intValue; } @@ -26,7 +26,7 @@ public enum CSSDimension { return mIntValue; } - public static CSSDimension fromInt(int value) { + public static YogaDimension fromInt(int value) { switch (value) { case 0: return WIDTH; case 1: return HEIGHT; diff --git a/java/com/facebook/csslayout/CSSDirection.java b/java/com/facebook/csslayout/YogaDirection.java similarity index 87% rename from java/com/facebook/csslayout/CSSDirection.java rename to java/com/facebook/csslayout/YogaDirection.java index 38916ea5..2c0473aa 100644 --- a/java/com/facebook/csslayout/CSSDirection.java +++ b/java/com/facebook/csslayout/YogaDirection.java @@ -12,14 +12,14 @@ package com.facebook.csslayout; import com.facebook.proguard.annotations.DoNotStrip; @DoNotStrip -public enum CSSDirection { +public enum YogaDirection { INHERIT(0), LTR(1), RTL(2); private int mIntValue; - CSSDirection(int intValue) { + YogaDirection(int intValue) { mIntValue = intValue; } @@ -27,7 +27,7 @@ public enum CSSDirection { return mIntValue; } - public static CSSDirection fromInt(int value) { + public static YogaDirection fromInt(int value) { switch (value) { case 0: return INHERIT; case 1: return LTR; diff --git a/java/com/facebook/csslayout/CSSEdge.java b/java/com/facebook/csslayout/YogaEdge.java similarity index 91% rename from java/com/facebook/csslayout/CSSEdge.java rename to java/com/facebook/csslayout/YogaEdge.java index 8fe6a2fb..811297f0 100644 --- a/java/com/facebook/csslayout/CSSEdge.java +++ b/java/com/facebook/csslayout/YogaEdge.java @@ -12,7 +12,7 @@ package com.facebook.csslayout; import com.facebook.proguard.annotations.DoNotStrip; @DoNotStrip -public enum CSSEdge { +public enum YogaEdge { LEFT(0), TOP(1), RIGHT(2), @@ -25,7 +25,7 @@ public enum CSSEdge { private int mIntValue; - CSSEdge(int intValue) { + YogaEdge(int intValue) { mIntValue = intValue; } @@ -33,7 +33,7 @@ public enum CSSEdge { return mIntValue; } - public static CSSEdge fromInt(int value) { + public static YogaEdge fromInt(int value) { switch (value) { case 0: return LEFT; case 1: return TOP; diff --git a/java/com/facebook/csslayout/CSSExperimentalFeature.java b/java/com/facebook/csslayout/YogaExperimentalFeature.java similarity index 83% rename from java/com/facebook/csslayout/CSSExperimentalFeature.java rename to java/com/facebook/csslayout/YogaExperimentalFeature.java index 3489e919..f0d91f0b 100644 --- a/java/com/facebook/csslayout/CSSExperimentalFeature.java +++ b/java/com/facebook/csslayout/YogaExperimentalFeature.java @@ -12,13 +12,13 @@ package com.facebook.csslayout; import com.facebook.proguard.annotations.DoNotStrip; @DoNotStrip -public enum CSSExperimentalFeature { +public enum YogaExperimentalFeature { ROUNDING(0), WEB_FLEX_BASIS(1); private int mIntValue; - CSSExperimentalFeature(int intValue) { + YogaExperimentalFeature(int intValue) { mIntValue = intValue; } @@ -26,7 +26,7 @@ public enum CSSExperimentalFeature { return mIntValue; } - public static CSSExperimentalFeature fromInt(int value) { + public static YogaExperimentalFeature fromInt(int value) { switch (value) { case 0: return ROUNDING; case 1: return WEB_FLEX_BASIS; diff --git a/java/com/facebook/csslayout/CSSFlexDirection.java b/java/com/facebook/csslayout/YogaFlexDirection.java similarity index 86% rename from java/com/facebook/csslayout/CSSFlexDirection.java rename to java/com/facebook/csslayout/YogaFlexDirection.java index 3047516d..b16128db 100644 --- a/java/com/facebook/csslayout/CSSFlexDirection.java +++ b/java/com/facebook/csslayout/YogaFlexDirection.java @@ -12,7 +12,7 @@ package com.facebook.csslayout; import com.facebook.proguard.annotations.DoNotStrip; @DoNotStrip -public enum CSSFlexDirection { +public enum YogaFlexDirection { COLUMN(0), COLUMN_REVERSE(1), ROW(2), @@ -20,7 +20,7 @@ public enum CSSFlexDirection { private int mIntValue; - CSSFlexDirection(int intValue) { + YogaFlexDirection(int intValue) { mIntValue = intValue; } @@ -28,7 +28,7 @@ public enum CSSFlexDirection { return mIntValue; } - public static CSSFlexDirection fromInt(int value) { + public static YogaFlexDirection fromInt(int value) { switch (value) { case 0: return COLUMN; case 1: return COLUMN_REVERSE; diff --git a/java/com/facebook/csslayout/CSSJustify.java b/java/com/facebook/csslayout/YogaJustify.java similarity index 89% rename from java/com/facebook/csslayout/CSSJustify.java rename to java/com/facebook/csslayout/YogaJustify.java index 2c9abc6b..eb328dd4 100644 --- a/java/com/facebook/csslayout/CSSJustify.java +++ b/java/com/facebook/csslayout/YogaJustify.java @@ -12,7 +12,7 @@ package com.facebook.csslayout; import com.facebook.proguard.annotations.DoNotStrip; @DoNotStrip -public enum CSSJustify { +public enum YogaJustify { FLEX_START(0), CENTER(1), FLEX_END(2), @@ -21,7 +21,7 @@ public enum CSSJustify { private int mIntValue; - CSSJustify(int intValue) { + YogaJustify(int intValue) { mIntValue = intValue; } @@ -29,7 +29,7 @@ public enum CSSJustify { return mIntValue; } - public static CSSJustify fromInt(int value) { + public static YogaJustify fromInt(int value) { switch (value) { case 0: return FLEX_START; case 1: return CENTER; diff --git a/java/com/facebook/csslayout/CSSLogLevel.java b/java/com/facebook/csslayout/YogaLogLevel.java similarity index 88% rename from java/com/facebook/csslayout/CSSLogLevel.java rename to java/com/facebook/csslayout/YogaLogLevel.java index 9d54b1eb..75d74e08 100644 --- a/java/com/facebook/csslayout/CSSLogLevel.java +++ b/java/com/facebook/csslayout/YogaLogLevel.java @@ -12,7 +12,7 @@ package com.facebook.csslayout; import com.facebook.proguard.annotations.DoNotStrip; @DoNotStrip -public enum CSSLogLevel { +public enum YogaLogLevel { ERROR(0), WARN(1), INFO(2), @@ -21,7 +21,7 @@ public enum CSSLogLevel { private int mIntValue; - CSSLogLevel(int intValue) { + YogaLogLevel(int intValue) { mIntValue = intValue; } @@ -29,7 +29,7 @@ public enum CSSLogLevel { return mIntValue; } - public static CSSLogLevel fromInt(int value) { + public static YogaLogLevel fromInt(int value) { switch (value) { case 0: return ERROR; case 1: return WARN; diff --git a/java/com/facebook/csslayout/CSSMeasureMode.java b/java/com/facebook/csslayout/YogaMeasureMode.java similarity index 86% rename from java/com/facebook/csslayout/CSSMeasureMode.java rename to java/com/facebook/csslayout/YogaMeasureMode.java index 5b14c7dd..6ea9d038 100644 --- a/java/com/facebook/csslayout/CSSMeasureMode.java +++ b/java/com/facebook/csslayout/YogaMeasureMode.java @@ -12,14 +12,14 @@ package com.facebook.csslayout; import com.facebook.proguard.annotations.DoNotStrip; @DoNotStrip -public enum CSSMeasureMode { +public enum YogaMeasureMode { UNDEFINED(0), EXACTLY(1), AT_MOST(2); private int mIntValue; - CSSMeasureMode(int intValue) { + YogaMeasureMode(int intValue) { mIntValue = intValue; } @@ -27,7 +27,7 @@ public enum CSSMeasureMode { return mIntValue; } - public static CSSMeasureMode fromInt(int value) { + public static YogaMeasureMode fromInt(int value) { switch (value) { case 0: return UNDEFINED; case 1: return EXACTLY; diff --git a/java/com/facebook/csslayout/CSSOverflow.java b/java/com/facebook/csslayout/YogaOverflow.java similarity index 87% rename from java/com/facebook/csslayout/CSSOverflow.java rename to java/com/facebook/csslayout/YogaOverflow.java index df6bedd7..0fa04bb4 100644 --- a/java/com/facebook/csslayout/CSSOverflow.java +++ b/java/com/facebook/csslayout/YogaOverflow.java @@ -12,14 +12,14 @@ package com.facebook.csslayout; import com.facebook.proguard.annotations.DoNotStrip; @DoNotStrip -public enum CSSOverflow { +public enum YogaOverflow { VISIBLE(0), HIDDEN(1), SCROLL(2); private int mIntValue; - CSSOverflow(int intValue) { + YogaOverflow(int intValue) { mIntValue = intValue; } @@ -27,7 +27,7 @@ public enum CSSOverflow { return mIntValue; } - public static CSSOverflow fromInt(int value) { + public static YogaOverflow fromInt(int value) { switch (value) { case 0: return VISIBLE; case 1: return HIDDEN; diff --git a/java/com/facebook/csslayout/CSSPositionType.java b/java/com/facebook/csslayout/YogaPositionType.java similarity index 85% rename from java/com/facebook/csslayout/CSSPositionType.java rename to java/com/facebook/csslayout/YogaPositionType.java index 01eeece6..0215c627 100644 --- a/java/com/facebook/csslayout/CSSPositionType.java +++ b/java/com/facebook/csslayout/YogaPositionType.java @@ -12,13 +12,13 @@ package com.facebook.csslayout; import com.facebook.proguard.annotations.DoNotStrip; @DoNotStrip -public enum CSSPositionType { +public enum YogaPositionType { RELATIVE(0), ABSOLUTE(1); private int mIntValue; - CSSPositionType(int intValue) { + YogaPositionType(int intValue) { mIntValue = intValue; } @@ -26,7 +26,7 @@ public enum CSSPositionType { return mIntValue; } - public static CSSPositionType fromInt(int value) { + public static YogaPositionType fromInt(int value) { switch (value) { case 0: return RELATIVE; case 1: return ABSOLUTE; diff --git a/java/com/facebook/csslayout/CSSPrintOptions.java b/java/com/facebook/csslayout/YogaPrintOptions.java similarity index 86% rename from java/com/facebook/csslayout/CSSPrintOptions.java rename to java/com/facebook/csslayout/YogaPrintOptions.java index 49cbc25e..fae22f0a 100644 --- a/java/com/facebook/csslayout/CSSPrintOptions.java +++ b/java/com/facebook/csslayout/YogaPrintOptions.java @@ -12,14 +12,14 @@ package com.facebook.csslayout; import com.facebook.proguard.annotations.DoNotStrip; @DoNotStrip -public enum CSSPrintOptions { +public enum YogaPrintOptions { LAYOUT(1), STYLE(2), CHILDREN(4); private int mIntValue; - CSSPrintOptions(int intValue) { + YogaPrintOptions(int intValue) { mIntValue = intValue; } @@ -27,7 +27,7 @@ public enum CSSPrintOptions { return mIntValue; } - public static CSSPrintOptions fromInt(int value) { + public static YogaPrintOptions fromInt(int value) { switch (value) { case 1: return LAYOUT; case 2: return STYLE; diff --git a/java/com/facebook/csslayout/CSSWrap.java b/java/com/facebook/csslayout/YogaWrap.java similarity index 88% rename from java/com/facebook/csslayout/CSSWrap.java rename to java/com/facebook/csslayout/YogaWrap.java index 52a7aaf8..8a371d5e 100644 --- a/java/com/facebook/csslayout/CSSWrap.java +++ b/java/com/facebook/csslayout/YogaWrap.java @@ -12,13 +12,13 @@ package com.facebook.csslayout; import com.facebook.proguard.annotations.DoNotStrip; @DoNotStrip -public enum CSSWrap { +public enum YogaWrap { NO_WRAP(0), WRAP(1); private int mIntValue; - CSSWrap(int intValue) { + YogaWrap(int intValue) { mIntValue = intValue; } @@ -26,7 +26,7 @@ public enum CSSWrap { return mIntValue; } - public static CSSWrap fromInt(int value) { + public static YogaWrap fromInt(int value) { switch (value) { case 0: return NO_WRAP; case 1: return WRAP; diff --git a/java/jni/CSSJNI.cpp b/java/jni/CSSJNI.cpp index 67946869..1a01570d 100644 --- a/java/jni/CSSJNI.cpp +++ b/java/jni/CSSJNI.cpp @@ -40,7 +40,7 @@ static void _jniTransferLayoutOutputsRecursive(CSSNodeRef root) { _jniTransferLayoutOutputsRecursive(CSSNodeGetChild(root, i)); } } else { - CSSLog(CSSLogLevelError, "Java CSSNode was GCed during layout calculation\n"); + CSSLog(YGLogLevelError, "Java CSSNode was GCed during layout calculation\n"); } } @@ -48,15 +48,15 @@ static void _jniPrint(CSSNodeRef node) { if (auto obj = jobjectContext(node)->lockLocal()) { cout << obj->toString() << endl; } else { - CSSLog(CSSLogLevelError, "Java CSSNode was GCed during layout calculation\n"); + CSSLog(YGLogLevelError, "Java CSSNode was GCed during layout calculation\n"); } } static CSSSize _jniMeasureFunc(CSSNodeRef node, float width, - CSSMeasureMode widthMode, + YGMeasureMode widthMode, float height, - CSSMeasureMode heightMode) { + YGMeasureMode heightMode) { if (auto obj = jobjectContext(node)->lockLocal()) { static auto measureFunc = findClassLocal("com/facebook/csslayout/CSSNode") ->getMethod("measure"); @@ -72,31 +72,31 @@ static CSSSize _jniMeasureFunc(CSSNodeRef node, return CSSSize{measuredWidth, measuredHeight}; } else { - CSSLog(CSSLogLevelError, "Java CSSNode was GCed during layout calculation\n"); + CSSLog(YGLogLevelError, "Java CSSNode was GCed during layout calculation\n"); return CSSSize{ - widthMode == CSSMeasureModeUndefined ? 0 : width, - heightMode == CSSMeasureModeUndefined ? 0 : height, + widthMode == YGMeasureModeUndefined ? 0 : width, + heightMode == YGMeasureModeUndefined ? 0 : height, }; } } -struct JCSSLogLevel : public JavaClass { - static constexpr auto kJavaDescriptor = "Lcom/facebook/csslayout/CSSLogLevel;"; +struct JYogaLogLevel : public JavaClass { + static constexpr auto kJavaDescriptor = "Lcom/facebook/csslayout/YogaLogLevel;"; }; static global_ref *jLogger; -static int _jniLog(CSSLogLevel level, const char *format, va_list args) { +static int _jniLog(YGLogLevel level, const char *format, va_list args) { char buffer[256]; int result = vsnprintf(buffer, sizeof(buffer), format, args); static auto logFunc = findClassLocal("com/facebook/csslayout/CSSLogger") - ->getMethod, jstring)>("log"); + ->getMethod, jstring)>("log"); static auto logLevelFromInt = - JCSSLogLevel::javaClassStatic()->getStaticMethod("fromInt"); + JYogaLogLevel::javaClassStatic()->getStaticMethod("fromInt"); logFunc(jLogger->get(), - logLevelFromInt(JCSSLogLevel::javaClassStatic(), static_cast(level)), + logLevelFromInt(JYogaLogLevel::javaClassStatic(), static_cast(level)), Environment::current()->NewStringUTF(buffer)); return result; @@ -123,18 +123,18 @@ void jni_CSSLayoutSetLogger(alias_ref clazz, alias_ref logger) void jni_CSSLog(alias_ref clazz, jint level, jstring message) { const char *nMessage = Environment::current()->GetStringUTFChars(message, 0); - CSSLog(static_cast(level), "%s", nMessage); + CSSLog(static_cast(level), "%s", nMessage); Environment::current()->ReleaseStringUTFChars(message, nMessage); } void jni_CSSLayoutSetExperimentalFeatureEnabled(alias_ref clazz, jint feature, jboolean enabled) { - CSSLayoutSetExperimentalFeatureEnabled(static_cast(feature), enabled); + CSSLayoutSetExperimentalFeatureEnabled(static_cast(feature), enabled); } jboolean jni_CSSLayoutIsExperimentalFeatureEnabled(alias_ref clazz, jint feature) { - return CSSLayoutIsExperimentalFeatureEnabled(static_cast(feature)); + return CSSLayoutIsExperimentalFeatureEnabled(static_cast(feature)); } jint jni_CSSNodeGetInstanceCount(alias_ref clazz) { @@ -176,8 +176,8 @@ void jni_CSSNodeRemoveChild(alias_ref, jlong nativePointer, jlong child void jni_CSSNodeCalculateLayout(alias_ref, jlong nativePointer) { const CSSNodeRef root = _jlong2CSSNodeRef(nativePointer); CSSNodeCalculateLayout(root, - CSSUndefined, - CSSUndefined, + YGUndefined, + YGUndefined, CSSNodeStyleGetDirection(_jlong2CSSNodeRef(nativePointer))); _jniTransferLayoutOutputsRecursive(root); } @@ -220,7 +220,7 @@ void jni_CSSNodeCopyStyle(alias_ref, jlong dstNativePointer, jlong srcN #define CSS_NODE_JNI_STYLE_EDGE_PROP(javatype, type, name) \ javatype jni_CSSNodeStyleGet##name(alias_ref, jlong nativePointer, jint edge) { \ return (javatype) CSSNodeStyleGet##name(_jlong2CSSNodeRef(nativePointer), \ - static_cast(edge)); \ + static_cast(edge)); \ } \ \ void jni_CSSNodeStyleSet##name(alias_ref, \ @@ -228,19 +228,19 @@ void jni_CSSNodeCopyStyle(alias_ref, jlong dstNativePointer, jlong srcN jint edge, \ javatype value) { \ CSSNodeStyleSet##name(_jlong2CSSNodeRef(nativePointer), \ - static_cast(edge), \ + static_cast(edge), \ static_cast(value)); \ } -CSS_NODE_JNI_STYLE_PROP(jint, CSSDirection, Direction); -CSS_NODE_JNI_STYLE_PROP(jint, CSSFlexDirection, FlexDirection); -CSS_NODE_JNI_STYLE_PROP(jint, CSSJustify, JustifyContent); -CSS_NODE_JNI_STYLE_PROP(jint, CSSAlign, AlignItems); -CSS_NODE_JNI_STYLE_PROP(jint, CSSAlign, AlignSelf); -CSS_NODE_JNI_STYLE_PROP(jint, CSSAlign, AlignContent); -CSS_NODE_JNI_STYLE_PROP(jint, CSSPositionType, PositionType); -CSS_NODE_JNI_STYLE_PROP(jint, CSSWrap, FlexWrap); -CSS_NODE_JNI_STYLE_PROP(jint, CSSOverflow, Overflow); +CSS_NODE_JNI_STYLE_PROP(jint, YGDirection, Direction); +CSS_NODE_JNI_STYLE_PROP(jint, YGFlexDirection, FlexDirection); +CSS_NODE_JNI_STYLE_PROP(jint, YGJustify, JustifyContent); +CSS_NODE_JNI_STYLE_PROP(jint, YGAlign, AlignItems); +CSS_NODE_JNI_STYLE_PROP(jint, YGAlign, AlignSelf); +CSS_NODE_JNI_STYLE_PROP(jint, YGAlign, AlignContent); +CSS_NODE_JNI_STYLE_PROP(jint, YGPositionType, PositionType); +CSS_NODE_JNI_STYLE_PROP(jint, YGWrap, FlexWrap); +CSS_NODE_JNI_STYLE_PROP(jint, YGOverflow, Overflow); void jni_CSSNodeStyleSetFlex(alias_ref, jlong nativePointer, jfloat value) { CSSNodeStyleSetFlex(_jlong2CSSNodeRef(nativePointer), static_cast(value)); diff --git a/java/tests/com/facebook/csslayout/CSSLayoutAbsolutePositionTest.java b/java/tests/com/facebook/csslayout/CSSLayoutAbsolutePositionTest.java index 78f42abc..c3ba26c7 100644 --- a/java/tests/com/facebook/csslayout/CSSLayoutAbsolutePositionTest.java +++ b/java/tests/com/facebook/csslayout/CSSLayoutAbsolutePositionTest.java @@ -23,13 +23,13 @@ public class CSSLayoutAbsolutePositionTest { root.setHeight(100f); final CSSNode root_child0 = new CSSNode(); - root_child0.setPositionType(CSSPositionType.ABSOLUTE); - root_child0.setPosition(CSSEdge.START, 10f); - root_child0.setPosition(CSSEdge.TOP, 10f); + root_child0.setPositionType(YogaPositionType.ABSOLUTE); + root_child0.setPosition(YogaEdge.START, 10f); + root_child0.setPosition(YogaEdge.TOP, 10f); root_child0.setWidth(10f); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -42,7 +42,7 @@ public class CSSLayoutAbsolutePositionTest { assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -63,13 +63,13 @@ public class CSSLayoutAbsolutePositionTest { root.setHeight(100f); final CSSNode root_child0 = new CSSNode(); - root_child0.setPositionType(CSSPositionType.ABSOLUTE); - root_child0.setPosition(CSSEdge.END, 10f); - root_child0.setPosition(CSSEdge.BOTTOM, 10f); + root_child0.setPositionType(YogaPositionType.ABSOLUTE); + root_child0.setPosition(YogaEdge.END, 10f); + root_child0.setPosition(YogaEdge.BOTTOM, 10f); root_child0.setWidth(10f); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -82,7 +82,7 @@ public class CSSLayoutAbsolutePositionTest { assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -103,13 +103,13 @@ public class CSSLayoutAbsolutePositionTest { root.setHeight(100f); final CSSNode root_child0 = new CSSNode(); - root_child0.setPositionType(CSSPositionType.ABSOLUTE); - root_child0.setPosition(CSSEdge.START, 10f); - root_child0.setPosition(CSSEdge.TOP, 10f); - root_child0.setPosition(CSSEdge.END, 10f); - root_child0.setPosition(CSSEdge.BOTTOM, 10f); + root_child0.setPositionType(YogaPositionType.ABSOLUTE); + root_child0.setPosition(YogaEdge.START, 10f); + root_child0.setPosition(YogaEdge.TOP, 10f); + root_child0.setPosition(YogaEdge.END, 10f); + root_child0.setPosition(YogaEdge.BOTTOM, 10f); root.addChildAt(root_child0, 0); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -122,7 +122,7 @@ public class CSSLayoutAbsolutePositionTest { assertEquals(80f, root_child0.getLayoutWidth(), 0.0f); assertEquals(80f, root_child0.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -143,15 +143,15 @@ public class CSSLayoutAbsolutePositionTest { root.setHeight(100f); final CSSNode root_child0 = new CSSNode(); - root_child0.setPositionType(CSSPositionType.ABSOLUTE); - root_child0.setPosition(CSSEdge.START, 10f); - root_child0.setPosition(CSSEdge.TOP, 10f); - root_child0.setPosition(CSSEdge.END, 10f); - root_child0.setPosition(CSSEdge.BOTTOM, 10f); + root_child0.setPositionType(YogaPositionType.ABSOLUTE); + root_child0.setPosition(YogaEdge.START, 10f); + root_child0.setPosition(YogaEdge.TOP, 10f); + root_child0.setPosition(YogaEdge.END, 10f); + root_child0.setPosition(YogaEdge.BOTTOM, 10f); root_child0.setWidth(10f); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -164,7 +164,7 @@ public class CSSLayoutAbsolutePositionTest { assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -181,22 +181,22 @@ public class CSSLayoutAbsolutePositionTest { @Test public void test_do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent() { final CSSNode root = new CSSNode(); - root.setFlexDirection(CSSFlexDirection.ROW); - root.setOverflow(CSSOverflow.HIDDEN); + root.setFlexDirection(YogaFlexDirection.ROW); + root.setOverflow(YogaOverflow.HIDDEN); root.setWidth(50f); root.setHeight(50f); final CSSNode root_child0 = new CSSNode(); - root_child0.setPositionType(CSSPositionType.ABSOLUTE); - root_child0.setPosition(CSSEdge.START, 0f); - root_child0.setPosition(CSSEdge.TOP, 0f); + root_child0.setPositionType(YogaPositionType.ABSOLUTE); + root_child0.setPosition(YogaEdge.START, 0f); + root_child0.setPosition(YogaEdge.TOP, 0f); root.addChildAt(root_child0, 0); final CSSNode root_child0_child0 = new CSSNode(); root_child0_child0.setWidth(100f); root_child0_child0.setHeight(100f); root_child0.addChildAt(root_child0_child0, 0); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -214,7 +214,7 @@ public class CSSLayoutAbsolutePositionTest { assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -236,37 +236,37 @@ public class CSSLayoutAbsolutePositionTest { @Test public void test_absolute_layout_within_border() { final CSSNode root = new CSSNode(); - root.setMargin(CSSEdge.LEFT, 10f); - root.setMargin(CSSEdge.TOP, 10f); - root.setMargin(CSSEdge.RIGHT, 10f); - root.setMargin(CSSEdge.BOTTOM, 10f); - root.setPadding(CSSEdge.LEFT, 10); - root.setPadding(CSSEdge.TOP, 10); - root.setPadding(CSSEdge.RIGHT, 10); - root.setPadding(CSSEdge.BOTTOM, 10); - root.setBorder(CSSEdge.LEFT, 10f); - root.setBorder(CSSEdge.TOP, 10f); - root.setBorder(CSSEdge.RIGHT, 10f); - root.setBorder(CSSEdge.BOTTOM, 10f); + root.setMargin(YogaEdge.LEFT, 10f); + root.setMargin(YogaEdge.TOP, 10f); + root.setMargin(YogaEdge.RIGHT, 10f); + root.setMargin(YogaEdge.BOTTOM, 10f); + root.setPadding(YogaEdge.LEFT, 10); + root.setPadding(YogaEdge.TOP, 10); + root.setPadding(YogaEdge.RIGHT, 10); + root.setPadding(YogaEdge.BOTTOM, 10); + root.setBorder(YogaEdge.LEFT, 10f); + root.setBorder(YogaEdge.TOP, 10f); + root.setBorder(YogaEdge.RIGHT, 10f); + root.setBorder(YogaEdge.BOTTOM, 10f); root.setWidth(100f); root.setHeight(100f); final CSSNode root_child0 = new CSSNode(); - root_child0.setPositionType(CSSPositionType.ABSOLUTE); - root_child0.setPosition(CSSEdge.LEFT, 0f); - root_child0.setPosition(CSSEdge.TOP, 0f); + root_child0.setPositionType(YogaPositionType.ABSOLUTE); + root_child0.setPosition(YogaEdge.LEFT, 0f); + root_child0.setPosition(YogaEdge.TOP, 0f); root_child0.setWidth(50f); root_child0.setHeight(50f); root.addChildAt(root_child0, 0); final CSSNode root_child1 = new CSSNode(); - root_child1.setPositionType(CSSPositionType.ABSOLUTE); - root_child1.setPosition(CSSEdge.RIGHT, 0f); - root_child1.setPosition(CSSEdge.BOTTOM, 0f); + root_child1.setPositionType(YogaPositionType.ABSOLUTE); + root_child1.setPosition(YogaEdge.RIGHT, 0f); + root_child1.setPosition(YogaEdge.BOTTOM, 0f); root_child1.setWidth(50f); root_child1.setHeight(50f); root.addChildAt(root_child1, 1); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(10f, root.getLayoutX(), 0.0f); @@ -284,7 +284,7 @@ public class CSSLayoutAbsolutePositionTest { assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(10f, root.getLayoutX(), 0.0f); diff --git a/java/tests/com/facebook/csslayout/CSSLayoutAlignContentTest.java b/java/tests/com/facebook/csslayout/CSSLayoutAlignContentTest.java index 45a6d49e..0c81f46d 100644 --- a/java/tests/com/facebook/csslayout/CSSLayoutAlignContentTest.java +++ b/java/tests/com/facebook/csslayout/CSSLayoutAlignContentTest.java @@ -19,7 +19,7 @@ public class CSSLayoutAlignContentTest { @Test public void test_align_content_flex_start() { final CSSNode root = new CSSNode(); - root.setWrap(CSSWrap.WRAP); + root.setWrap(YogaWrap.WRAP); root.setWidth(100f); root.setHeight(100f); @@ -47,7 +47,7 @@ public class CSSLayoutAlignContentTest { root_child4.setWidth(50f); root_child4.setHeight(10f); root.addChildAt(root_child4, 4); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -80,7 +80,7 @@ public class CSSLayoutAlignContentTest { assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(10f, root_child4.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -117,8 +117,8 @@ public class CSSLayoutAlignContentTest { @Test public void test_align_content_flex_end() { final CSSNode root = new CSSNode(); - root.setAlignContent(CSSAlign.FLEX_END); - root.setWrap(CSSWrap.WRAP); + root.setAlignContent(YogaAlign.FLEX_END); + root.setWrap(YogaWrap.WRAP); root.setWidth(100f); root.setHeight(100f); @@ -146,7 +146,7 @@ public class CSSLayoutAlignContentTest { root_child4.setWidth(50f); root_child4.setHeight(10f); root.addChildAt(root_child4, 4); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -179,7 +179,7 @@ public class CSSLayoutAlignContentTest { assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(10f, root_child4.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -216,8 +216,8 @@ public class CSSLayoutAlignContentTest { @Test public void test_align_content_center() { final CSSNode root = new CSSNode(); - root.setAlignContent(CSSAlign.CENTER); - root.setWrap(CSSWrap.WRAP); + root.setAlignContent(YogaAlign.CENTER); + root.setWrap(YogaWrap.WRAP); root.setWidth(100f); root.setHeight(100f); @@ -245,7 +245,7 @@ public class CSSLayoutAlignContentTest { root_child4.setWidth(50f); root_child4.setHeight(10f); root.addChildAt(root_child4, 4); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -278,7 +278,7 @@ public class CSSLayoutAlignContentTest { assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(10f, root_child4.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -315,8 +315,8 @@ public class CSSLayoutAlignContentTest { @Test public void test_align_content_stretch() { final CSSNode root = new CSSNode(); - root.setAlignContent(CSSAlign.STRETCH); - root.setWrap(CSSWrap.WRAP); + root.setAlignContent(YogaAlign.STRETCH); + root.setWrap(YogaWrap.WRAP); root.setWidth(100f); root.setHeight(100f); @@ -339,7 +339,7 @@ public class CSSLayoutAlignContentTest { final CSSNode root_child4 = new CSSNode(); root_child4.setWidth(50f); root.addChildAt(root_child4, 4); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -372,7 +372,7 @@ public class CSSLayoutAlignContentTest { assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(0f, root_child4.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); diff --git a/java/tests/com/facebook/csslayout/CSSLayoutAlignItemsTest.java b/java/tests/com/facebook/csslayout/CSSLayoutAlignItemsTest.java index ce29f740..4dcdcea4 100644 --- a/java/tests/com/facebook/csslayout/CSSLayoutAlignItemsTest.java +++ b/java/tests/com/facebook/csslayout/CSSLayoutAlignItemsTest.java @@ -25,7 +25,7 @@ public class CSSLayoutAlignItemsTest { final CSSNode root_child0 = new CSSNode(); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -38,7 +38,7 @@ public class CSSLayoutAlignItemsTest { assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -55,7 +55,7 @@ public class CSSLayoutAlignItemsTest { @Test public void test_align_items_center() { final CSSNode root = new CSSNode(); - root.setAlignItems(CSSAlign.CENTER); + root.setAlignItems(YogaAlign.CENTER); root.setWidth(100f); root.setHeight(100f); @@ -63,7 +63,7 @@ public class CSSLayoutAlignItemsTest { root_child0.setWidth(10f); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -76,7 +76,7 @@ public class CSSLayoutAlignItemsTest { assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -93,7 +93,7 @@ public class CSSLayoutAlignItemsTest { @Test public void test_align_items_flex_start() { final CSSNode root = new CSSNode(); - root.setAlignItems(CSSAlign.FLEX_START); + root.setAlignItems(YogaAlign.FLEX_START); root.setWidth(100f); root.setHeight(100f); @@ -101,7 +101,7 @@ public class CSSLayoutAlignItemsTest { root_child0.setWidth(10f); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -114,7 +114,7 @@ public class CSSLayoutAlignItemsTest { assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -131,7 +131,7 @@ public class CSSLayoutAlignItemsTest { @Test public void test_align_items_flex_end() { final CSSNode root = new CSSNode(); - root.setAlignItems(CSSAlign.FLEX_END); + root.setAlignItems(YogaAlign.FLEX_END); root.setWidth(100f); root.setHeight(100f); @@ -139,7 +139,7 @@ public class CSSLayoutAlignItemsTest { root_child0.setWidth(10f); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -152,7 +152,7 @@ public class CSSLayoutAlignItemsTest { assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); diff --git a/java/tests/com/facebook/csslayout/CSSLayoutAlignSelfTest.java b/java/tests/com/facebook/csslayout/CSSLayoutAlignSelfTest.java index c2ae50e2..3651e5b3 100644 --- a/java/tests/com/facebook/csslayout/CSSLayoutAlignSelfTest.java +++ b/java/tests/com/facebook/csslayout/CSSLayoutAlignSelfTest.java @@ -23,11 +23,11 @@ public class CSSLayoutAlignSelfTest { root.setHeight(100f); final CSSNode root_child0 = new CSSNode(); - root_child0.setAlignSelf(CSSAlign.CENTER); + root_child0.setAlignSelf(YogaAlign.CENTER); root_child0.setWidth(10f); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -40,7 +40,7 @@ public class CSSLayoutAlignSelfTest { assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -61,11 +61,11 @@ public class CSSLayoutAlignSelfTest { root.setHeight(100f); final CSSNode root_child0 = new CSSNode(); - root_child0.setAlignSelf(CSSAlign.FLEX_END); + root_child0.setAlignSelf(YogaAlign.FLEX_END); root_child0.setWidth(10f); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -78,7 +78,7 @@ public class CSSLayoutAlignSelfTest { assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -99,11 +99,11 @@ public class CSSLayoutAlignSelfTest { root.setHeight(100f); final CSSNode root_child0 = new CSSNode(); - root_child0.setAlignSelf(CSSAlign.FLEX_START); + root_child0.setAlignSelf(YogaAlign.FLEX_START); root_child0.setWidth(10f); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -116,7 +116,7 @@ public class CSSLayoutAlignSelfTest { assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -133,16 +133,16 @@ public class CSSLayoutAlignSelfTest { @Test public void test_align_self_flex_end_override_flex_start() { final CSSNode root = new CSSNode(); - root.setAlignItems(CSSAlign.FLEX_START); + root.setAlignItems(YogaAlign.FLEX_START); root.setWidth(100f); root.setHeight(100f); final CSSNode root_child0 = new CSSNode(); - root_child0.setAlignSelf(CSSAlign.FLEX_END); + root_child0.setAlignSelf(YogaAlign.FLEX_END); root_child0.setWidth(10f); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -155,7 +155,7 @@ public class CSSLayoutAlignSelfTest { assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); diff --git a/java/tests/com/facebook/csslayout/CSSLayoutBorderTest.java b/java/tests/com/facebook/csslayout/CSSLayoutBorderTest.java index 3acd73fa..1e1ac2ca 100644 --- a/java/tests/com/facebook/csslayout/CSSLayoutBorderTest.java +++ b/java/tests/com/facebook/csslayout/CSSLayoutBorderTest.java @@ -19,11 +19,11 @@ public class CSSLayoutBorderTest { @Test public void test_border_no_size() { final CSSNode root = new CSSNode(); - root.setBorder(CSSEdge.LEFT, 10f); - root.setBorder(CSSEdge.TOP, 10f); - root.setBorder(CSSEdge.RIGHT, 10f); - root.setBorder(CSSEdge.BOTTOM, 10f); - root.setDirection(CSSDirection.LTR); + root.setBorder(YogaEdge.LEFT, 10f); + root.setBorder(YogaEdge.TOP, 10f); + root.setBorder(YogaEdge.RIGHT, 10f); + root.setBorder(YogaEdge.BOTTOM, 10f); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -31,7 +31,7 @@ public class CSSLayoutBorderTest { assertEquals(20f, root.getLayoutWidth(), 0.0f); assertEquals(20f, root.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -43,16 +43,16 @@ public class CSSLayoutBorderTest { @Test public void test_border_container_match_child() { final CSSNode root = new CSSNode(); - root.setBorder(CSSEdge.LEFT, 10f); - root.setBorder(CSSEdge.TOP, 10f); - root.setBorder(CSSEdge.RIGHT, 10f); - root.setBorder(CSSEdge.BOTTOM, 10f); + root.setBorder(YogaEdge.LEFT, 10f); + root.setBorder(YogaEdge.TOP, 10f); + root.setBorder(YogaEdge.RIGHT, 10f); + root.setBorder(YogaEdge.BOTTOM, 10f); final CSSNode root_child0 = new CSSNode(); root_child0.setWidth(10f); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -65,7 +65,7 @@ public class CSSLayoutBorderTest { assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -82,10 +82,10 @@ public class CSSLayoutBorderTest { @Test public void test_border_flex_child() { final CSSNode root = new CSSNode(); - root.setBorder(CSSEdge.LEFT, 10f); - root.setBorder(CSSEdge.TOP, 10f); - root.setBorder(CSSEdge.RIGHT, 10f); - root.setBorder(CSSEdge.BOTTOM, 10f); + root.setBorder(YogaEdge.LEFT, 10f); + root.setBorder(YogaEdge.TOP, 10f); + root.setBorder(YogaEdge.RIGHT, 10f); + root.setBorder(YogaEdge.BOTTOM, 10f); root.setWidth(100f); root.setHeight(100f); @@ -93,7 +93,7 @@ public class CSSLayoutBorderTest { root_child0.setFlexGrow(1f); root_child0.setWidth(10f); root.addChildAt(root_child0, 0); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -106,7 +106,7 @@ public class CSSLayoutBorderTest { assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(80f, root_child0.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -123,17 +123,17 @@ public class CSSLayoutBorderTest { @Test public void test_border_stretch_child() { final CSSNode root = new CSSNode(); - root.setBorder(CSSEdge.LEFT, 10f); - root.setBorder(CSSEdge.TOP, 10f); - root.setBorder(CSSEdge.RIGHT, 10f); - root.setBorder(CSSEdge.BOTTOM, 10f); + root.setBorder(YogaEdge.LEFT, 10f); + root.setBorder(YogaEdge.TOP, 10f); + root.setBorder(YogaEdge.RIGHT, 10f); + root.setBorder(YogaEdge.BOTTOM, 10f); root.setWidth(100f); root.setHeight(100f); final CSSNode root_child0 = new CSSNode(); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -146,7 +146,7 @@ public class CSSLayoutBorderTest { assertEquals(80f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -163,11 +163,11 @@ public class CSSLayoutBorderTest { @Test public void test_border_center_child() { final CSSNode root = new CSSNode(); - root.setJustifyContent(CSSJustify.CENTER); - root.setAlignItems(CSSAlign.CENTER); - root.setBorder(CSSEdge.START, 10f); - root.setBorder(CSSEdge.END, 20f); - root.setBorder(CSSEdge.BOTTOM, 20f); + root.setJustifyContent(YogaJustify.CENTER); + root.setAlignItems(YogaAlign.CENTER); + root.setBorder(YogaEdge.START, 10f); + root.setBorder(YogaEdge.END, 20f); + root.setBorder(YogaEdge.BOTTOM, 20f); root.setWidth(100f); root.setHeight(100f); @@ -175,7 +175,7 @@ public class CSSLayoutBorderTest { root_child0.setWidth(10f); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -188,7 +188,7 @@ public class CSSLayoutBorderTest { assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); diff --git a/java/tests/com/facebook/csslayout/CSSLayoutFlexDirectionTest.java b/java/tests/com/facebook/csslayout/CSSLayoutFlexDirectionTest.java index fad52543..73b1a98e 100644 --- a/java/tests/com/facebook/csslayout/CSSLayoutFlexDirectionTest.java +++ b/java/tests/com/facebook/csslayout/CSSLayoutFlexDirectionTest.java @@ -32,7 +32,7 @@ public class CSSLayoutFlexDirectionTest { final CSSNode root_child2 = new CSSNode(); root_child2.setHeight(10f); root.addChildAt(root_child2, 2); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -55,7 +55,7 @@ public class CSSLayoutFlexDirectionTest { assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -82,7 +82,7 @@ public class CSSLayoutFlexDirectionTest { @Test public void test_flex_direction_row_no_width() { final CSSNode root = new CSSNode(); - root.setFlexDirection(CSSFlexDirection.ROW); + root.setFlexDirection(YogaFlexDirection.ROW); root.setHeight(100f); final CSSNode root_child0 = new CSSNode(); @@ -96,7 +96,7 @@ public class CSSLayoutFlexDirectionTest { final CSSNode root_child2 = new CSSNode(); root_child2.setWidth(10f); root.addChildAt(root_child2, 2); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -119,7 +119,7 @@ public class CSSLayoutFlexDirectionTest { assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -160,7 +160,7 @@ public class CSSLayoutFlexDirectionTest { final CSSNode root_child2 = new CSSNode(); root_child2.setHeight(10f); root.addChildAt(root_child2, 2); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -183,7 +183,7 @@ public class CSSLayoutFlexDirectionTest { assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -210,7 +210,7 @@ public class CSSLayoutFlexDirectionTest { @Test public void test_flex_direction_row() { final CSSNode root = new CSSNode(); - root.setFlexDirection(CSSFlexDirection.ROW); + root.setFlexDirection(YogaFlexDirection.ROW); root.setWidth(100f); root.setHeight(100f); @@ -225,7 +225,7 @@ public class CSSLayoutFlexDirectionTest { final CSSNode root_child2 = new CSSNode(); root_child2.setWidth(10f); root.addChildAt(root_child2, 2); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -248,7 +248,7 @@ public class CSSLayoutFlexDirectionTest { assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -275,7 +275,7 @@ public class CSSLayoutFlexDirectionTest { @Test public void test_flex_direction_column_reverse() { final CSSNode root = new CSSNode(); - root.setFlexDirection(CSSFlexDirection.COLUMN_REVERSE); + root.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE); root.setWidth(100f); root.setHeight(100f); @@ -290,7 +290,7 @@ public class CSSLayoutFlexDirectionTest { final CSSNode root_child2 = new CSSNode(); root_child2.setHeight(10f); root.addChildAt(root_child2, 2); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -313,7 +313,7 @@ public class CSSLayoutFlexDirectionTest { assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -340,7 +340,7 @@ public class CSSLayoutFlexDirectionTest { @Test public void test_flex_direction_row_reverse() { final CSSNode root = new CSSNode(); - root.setFlexDirection(CSSFlexDirection.ROW_REVERSE); + root.setFlexDirection(YogaFlexDirection.ROW_REVERSE); root.setWidth(100f); root.setHeight(100f); @@ -355,7 +355,7 @@ public class CSSLayoutFlexDirectionTest { final CSSNode root_child2 = new CSSNode(); root_child2.setWidth(10f); root.addChildAt(root_child2, 2); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -378,7 +378,7 @@ public class CSSLayoutFlexDirectionTest { assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); diff --git a/java/tests/com/facebook/csslayout/CSSLayoutFlexTest.java b/java/tests/com/facebook/csslayout/CSSLayoutFlexTest.java index a9421f35..3d4f1b84 100644 --- a/java/tests/com/facebook/csslayout/CSSLayoutFlexTest.java +++ b/java/tests/com/facebook/csslayout/CSSLayoutFlexTest.java @@ -30,7 +30,7 @@ public class CSSLayoutFlexTest { final CSSNode root_child1 = new CSSNode(); root_child1.setFlexGrow(1f); root.addChildAt(root_child1, 1); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -48,7 +48,7 @@ public class CSSLayoutFlexTest { assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(25f, root_child1.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -70,7 +70,7 @@ public class CSSLayoutFlexTest { @Test public void test_flex_basis_flex_grow_row() { final CSSNode root = new CSSNode(); - root.setFlexDirection(CSSFlexDirection.ROW); + root.setFlexDirection(YogaFlexDirection.ROW); root.setWidth(100f); root.setHeight(100f); @@ -82,7 +82,7 @@ public class CSSLayoutFlexTest { final CSSNode root_child1 = new CSSNode(); root_child1.setFlexGrow(1f); root.addChildAt(root_child1, 1); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -100,7 +100,7 @@ public class CSSLayoutFlexTest { assertEquals(25f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -133,7 +133,7 @@ public class CSSLayoutFlexTest { final CSSNode root_child1 = new CSSNode(); root_child1.setFlexBasis(50f); root.addChildAt(root_child1, 1); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -151,7 +151,7 @@ public class CSSLayoutFlexTest { assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -173,7 +173,7 @@ public class CSSLayoutFlexTest { @Test public void test_flex_basis_flex_shrink_row() { final CSSNode root = new CSSNode(); - root.setFlexDirection(CSSFlexDirection.ROW); + root.setFlexDirection(YogaFlexDirection.ROW); root.setWidth(100f); root.setHeight(100f); @@ -185,7 +185,7 @@ public class CSSLayoutFlexTest { final CSSNode root_child1 = new CSSNode(); root_child1.setFlexBasis(50f); root.addChildAt(root_child1, 1); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -203,7 +203,7 @@ public class CSSLayoutFlexTest { assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -242,7 +242,7 @@ public class CSSLayoutFlexTest { root_child2.setWidth(50f); root_child2.setHeight(50f); root.addChildAt(root_child2, 2); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -265,7 +265,7 @@ public class CSSLayoutFlexTest { assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); assertEquals(50f, root_child2.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -310,7 +310,7 @@ public class CSSLayoutFlexTest { root_child2.setFlexGrow(1f); root_child2.setHeight(10f); root.addChildAt(root_child2, 2); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -333,7 +333,7 @@ public class CSSLayoutFlexTest { assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(20f, root_child2.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -370,7 +370,7 @@ public class CSSLayoutFlexTest { root_child0_child0.setFlexGrow(1f); root_child0_child0.setFlexShrink(1f); root_child0.addChildAt(root_child0_child0, 0); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -388,7 +388,7 @@ public class CSSLayoutFlexTest { assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); diff --git a/java/tests/com/facebook/csslayout/CSSLayoutFlexWrapTest.java b/java/tests/com/facebook/csslayout/CSSLayoutFlexWrapTest.java index c0850c1c..8df07243 100644 --- a/java/tests/com/facebook/csslayout/CSSLayoutFlexWrapTest.java +++ b/java/tests/com/facebook/csslayout/CSSLayoutFlexWrapTest.java @@ -19,7 +19,7 @@ public class CSSLayoutFlexWrapTest { @Test public void test_wrap_column() { final CSSNode root = new CSSNode(); - root.setWrap(CSSWrap.WRAP); + root.setWrap(YogaWrap.WRAP); root.setHeight(100f); final CSSNode root_child0 = new CSSNode(); @@ -41,7 +41,7 @@ public class CSSLayoutFlexWrapTest { root_child3.setWidth(30f); root_child3.setHeight(30f); root.addChildAt(root_child3, 3); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -69,7 +69,7 @@ public class CSSLayoutFlexWrapTest { assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); assertEquals(30f, root_child3.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -101,8 +101,8 @@ public class CSSLayoutFlexWrapTest { @Test public void test_wrap_row() { final CSSNode root = new CSSNode(); - root.setFlexDirection(CSSFlexDirection.ROW); - root.setWrap(CSSWrap.WRAP); + root.setFlexDirection(YogaFlexDirection.ROW); + root.setWrap(YogaWrap.WRAP); root.setWidth(100f); final CSSNode root_child0 = new CSSNode(); @@ -124,7 +124,7 @@ public class CSSLayoutFlexWrapTest { root_child3.setWidth(30f); root_child3.setHeight(30f); root.addChildAt(root_child3, 3); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -152,7 +152,7 @@ public class CSSLayoutFlexWrapTest { assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); assertEquals(30f, root_child3.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -184,9 +184,9 @@ public class CSSLayoutFlexWrapTest { @Test public void test_wrap_row_align_items_flex_end() { final CSSNode root = new CSSNode(); - root.setFlexDirection(CSSFlexDirection.ROW); - root.setAlignItems(CSSAlign.FLEX_END); - root.setWrap(CSSWrap.WRAP); + root.setFlexDirection(YogaFlexDirection.ROW); + root.setAlignItems(YogaAlign.FLEX_END); + root.setWrap(YogaWrap.WRAP); root.setWidth(100f); final CSSNode root_child0 = new CSSNode(); @@ -208,7 +208,7 @@ public class CSSLayoutFlexWrapTest { root_child3.setWidth(30f); root_child3.setHeight(30f); root.addChildAt(root_child3, 3); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -236,7 +236,7 @@ public class CSSLayoutFlexWrapTest { assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); assertEquals(30f, root_child3.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -268,9 +268,9 @@ public class CSSLayoutFlexWrapTest { @Test public void test_wrap_row_align_items_center() { final CSSNode root = new CSSNode(); - root.setFlexDirection(CSSFlexDirection.ROW); - root.setAlignItems(CSSAlign.CENTER); - root.setWrap(CSSWrap.WRAP); + root.setFlexDirection(YogaFlexDirection.ROW); + root.setAlignItems(YogaAlign.CENTER); + root.setWrap(YogaWrap.WRAP); root.setWidth(100f); final CSSNode root_child0 = new CSSNode(); @@ -292,7 +292,7 @@ public class CSSLayoutFlexWrapTest { root_child3.setWidth(30f); root_child3.setHeight(30f); root.addChildAt(root_child3, 3); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -320,7 +320,7 @@ public class CSSLayoutFlexWrapTest { assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); assertEquals(30f, root_child3.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); diff --git a/java/tests/com/facebook/csslayout/CSSLayoutJustifyContentTest.java b/java/tests/com/facebook/csslayout/CSSLayoutJustifyContentTest.java index 310c31c3..2f486e6f 100644 --- a/java/tests/com/facebook/csslayout/CSSLayoutJustifyContentTest.java +++ b/java/tests/com/facebook/csslayout/CSSLayoutJustifyContentTest.java @@ -19,7 +19,7 @@ public class CSSLayoutJustifyContentTest { @Test public void test_justify_content_row_flex_start() { final CSSNode root = new CSSNode(); - root.setFlexDirection(CSSFlexDirection.ROW); + root.setFlexDirection(YogaFlexDirection.ROW); root.setWidth(102f); root.setHeight(102f); @@ -34,7 +34,7 @@ public class CSSLayoutJustifyContentTest { final CSSNode root_child2 = new CSSNode(); root_child2.setWidth(10f); root.addChildAt(root_child2, 2); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -57,7 +57,7 @@ public class CSSLayoutJustifyContentTest { assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(102f, root_child2.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -84,8 +84,8 @@ public class CSSLayoutJustifyContentTest { @Test public void test_justify_content_row_flex_end() { final CSSNode root = new CSSNode(); - root.setFlexDirection(CSSFlexDirection.ROW); - root.setJustifyContent(CSSJustify.FLEX_END); + root.setFlexDirection(YogaFlexDirection.ROW); + root.setJustifyContent(YogaJustify.FLEX_END); root.setWidth(102f); root.setHeight(102f); @@ -100,7 +100,7 @@ public class CSSLayoutJustifyContentTest { final CSSNode root_child2 = new CSSNode(); root_child2.setWidth(10f); root.addChildAt(root_child2, 2); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -123,7 +123,7 @@ public class CSSLayoutJustifyContentTest { assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(102f, root_child2.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -150,8 +150,8 @@ public class CSSLayoutJustifyContentTest { @Test public void test_justify_content_row_center() { final CSSNode root = new CSSNode(); - root.setFlexDirection(CSSFlexDirection.ROW); - root.setJustifyContent(CSSJustify.CENTER); + root.setFlexDirection(YogaFlexDirection.ROW); + root.setJustifyContent(YogaJustify.CENTER); root.setWidth(102f); root.setHeight(102f); @@ -166,7 +166,7 @@ public class CSSLayoutJustifyContentTest { final CSSNode root_child2 = new CSSNode(); root_child2.setWidth(10f); root.addChildAt(root_child2, 2); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -189,7 +189,7 @@ public class CSSLayoutJustifyContentTest { assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(102f, root_child2.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -216,8 +216,8 @@ public class CSSLayoutJustifyContentTest { @Test public void test_justify_content_row_space_between() { final CSSNode root = new CSSNode(); - root.setFlexDirection(CSSFlexDirection.ROW); - root.setJustifyContent(CSSJustify.SPACE_BETWEEN); + root.setFlexDirection(YogaFlexDirection.ROW); + root.setJustifyContent(YogaJustify.SPACE_BETWEEN); root.setWidth(102f); root.setHeight(102f); @@ -232,7 +232,7 @@ public class CSSLayoutJustifyContentTest { final CSSNode root_child2 = new CSSNode(); root_child2.setWidth(10f); root.addChildAt(root_child2, 2); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -255,7 +255,7 @@ public class CSSLayoutJustifyContentTest { assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(102f, root_child2.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -282,8 +282,8 @@ public class CSSLayoutJustifyContentTest { @Test public void test_justify_content_row_space_around() { final CSSNode root = new CSSNode(); - root.setFlexDirection(CSSFlexDirection.ROW); - root.setJustifyContent(CSSJustify.SPACE_AROUND); + root.setFlexDirection(YogaFlexDirection.ROW); + root.setJustifyContent(YogaJustify.SPACE_AROUND); root.setWidth(102f); root.setHeight(102f); @@ -298,7 +298,7 @@ public class CSSLayoutJustifyContentTest { final CSSNode root_child2 = new CSSNode(); root_child2.setWidth(10f); root.addChildAt(root_child2, 2); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -321,7 +321,7 @@ public class CSSLayoutJustifyContentTest { assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(102f, root_child2.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -361,7 +361,7 @@ public class CSSLayoutJustifyContentTest { final CSSNode root_child2 = new CSSNode(); root_child2.setHeight(10f); root.addChildAt(root_child2, 2); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -384,7 +384,7 @@ public class CSSLayoutJustifyContentTest { assertEquals(102f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -411,7 +411,7 @@ public class CSSLayoutJustifyContentTest { @Test public void test_justify_content_column_flex_end() { final CSSNode root = new CSSNode(); - root.setJustifyContent(CSSJustify.FLEX_END); + root.setJustifyContent(YogaJustify.FLEX_END); root.setWidth(102f); root.setHeight(102f); @@ -426,7 +426,7 @@ public class CSSLayoutJustifyContentTest { final CSSNode root_child2 = new CSSNode(); root_child2.setHeight(10f); root.addChildAt(root_child2, 2); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -449,7 +449,7 @@ public class CSSLayoutJustifyContentTest { assertEquals(102f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -476,7 +476,7 @@ public class CSSLayoutJustifyContentTest { @Test public void test_justify_content_column_center() { final CSSNode root = new CSSNode(); - root.setJustifyContent(CSSJustify.CENTER); + root.setJustifyContent(YogaJustify.CENTER); root.setWidth(102f); root.setHeight(102f); @@ -491,7 +491,7 @@ public class CSSLayoutJustifyContentTest { final CSSNode root_child2 = new CSSNode(); root_child2.setHeight(10f); root.addChildAt(root_child2, 2); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -514,7 +514,7 @@ public class CSSLayoutJustifyContentTest { assertEquals(102f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -541,7 +541,7 @@ public class CSSLayoutJustifyContentTest { @Test public void test_justify_content_column_space_between() { final CSSNode root = new CSSNode(); - root.setJustifyContent(CSSJustify.SPACE_BETWEEN); + root.setJustifyContent(YogaJustify.SPACE_BETWEEN); root.setWidth(102f); root.setHeight(102f); @@ -556,7 +556,7 @@ public class CSSLayoutJustifyContentTest { final CSSNode root_child2 = new CSSNode(); root_child2.setHeight(10f); root.addChildAt(root_child2, 2); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -579,7 +579,7 @@ public class CSSLayoutJustifyContentTest { assertEquals(102f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -606,7 +606,7 @@ public class CSSLayoutJustifyContentTest { @Test public void test_justify_content_column_space_around() { final CSSNode root = new CSSNode(); - root.setJustifyContent(CSSJustify.SPACE_AROUND); + root.setJustifyContent(YogaJustify.SPACE_AROUND); root.setWidth(102f); root.setHeight(102f); @@ -621,7 +621,7 @@ public class CSSLayoutJustifyContentTest { final CSSNode root_child2 = new CSSNode(); root_child2.setHeight(10f); root.addChildAt(root_child2, 2); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -644,7 +644,7 @@ public class CSSLayoutJustifyContentTest { assertEquals(102f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); diff --git a/java/tests/com/facebook/csslayout/CSSLayoutMarginTest.java b/java/tests/com/facebook/csslayout/CSSLayoutMarginTest.java index 63a07584..f265ef7b 100644 --- a/java/tests/com/facebook/csslayout/CSSLayoutMarginTest.java +++ b/java/tests/com/facebook/csslayout/CSSLayoutMarginTest.java @@ -19,15 +19,15 @@ public class CSSLayoutMarginTest { @Test public void test_margin_start() { final CSSNode root = new CSSNode(); - root.setFlexDirection(CSSFlexDirection.ROW); + root.setFlexDirection(YogaFlexDirection.ROW); root.setWidth(100f); root.setHeight(100f); final CSSNode root_child0 = new CSSNode(); - root_child0.setMargin(CSSEdge.START, 10f); + root_child0.setMargin(YogaEdge.START, 10f); root_child0.setWidth(10f); root.addChildAt(root_child0, 0); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -40,7 +40,7 @@ public class CSSLayoutMarginTest { assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -61,10 +61,10 @@ public class CSSLayoutMarginTest { root.setHeight(100f); final CSSNode root_child0 = new CSSNode(); - root_child0.setMargin(CSSEdge.TOP, 10f); + root_child0.setMargin(YogaEdge.TOP, 10f); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -77,7 +77,7 @@ public class CSSLayoutMarginTest { assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -94,16 +94,16 @@ public class CSSLayoutMarginTest { @Test public void test_margin_end() { final CSSNode root = new CSSNode(); - root.setFlexDirection(CSSFlexDirection.ROW); - root.setJustifyContent(CSSJustify.FLEX_END); + root.setFlexDirection(YogaFlexDirection.ROW); + root.setJustifyContent(YogaJustify.FLEX_END); root.setWidth(100f); root.setHeight(100f); final CSSNode root_child0 = new CSSNode(); - root_child0.setMargin(CSSEdge.END, 10f); + root_child0.setMargin(YogaEdge.END, 10f); root_child0.setWidth(10f); root.addChildAt(root_child0, 0); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -116,7 +116,7 @@ public class CSSLayoutMarginTest { assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -133,15 +133,15 @@ public class CSSLayoutMarginTest { @Test public void test_margin_bottom() { final CSSNode root = new CSSNode(); - root.setJustifyContent(CSSJustify.FLEX_END); + root.setJustifyContent(YogaJustify.FLEX_END); root.setWidth(100f); root.setHeight(100f); final CSSNode root_child0 = new CSSNode(); - root_child0.setMargin(CSSEdge.BOTTOM, 10f); + root_child0.setMargin(YogaEdge.BOTTOM, 10f); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -154,7 +154,7 @@ public class CSSLayoutMarginTest { assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -171,15 +171,15 @@ public class CSSLayoutMarginTest { @Test public void test_margin_and_flex_row() { final CSSNode root = new CSSNode(); - root.setFlexDirection(CSSFlexDirection.ROW); + root.setFlexDirection(YogaFlexDirection.ROW); root.setWidth(100f); root.setHeight(100f); final CSSNode root_child0 = new CSSNode(); root_child0.setFlexGrow(1f); - root_child0.setMargin(CSSEdge.START, 10f); + root_child0.setMargin(YogaEdge.START, 10f); root.addChildAt(root_child0, 0); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -192,7 +192,7 @@ public class CSSLayoutMarginTest { assertEquals(90f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -214,9 +214,9 @@ public class CSSLayoutMarginTest { final CSSNode root_child0 = new CSSNode(); root_child0.setFlexGrow(1f); - root_child0.setMargin(CSSEdge.TOP, 10f); + root_child0.setMargin(YogaEdge.TOP, 10f); root.addChildAt(root_child0, 0); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -229,7 +229,7 @@ public class CSSLayoutMarginTest { assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(90f, root_child0.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -246,15 +246,15 @@ public class CSSLayoutMarginTest { @Test public void test_margin_and_stretch_row() { final CSSNode root = new CSSNode(); - root.setFlexDirection(CSSFlexDirection.ROW); + root.setFlexDirection(YogaFlexDirection.ROW); root.setWidth(100f); root.setHeight(100f); final CSSNode root_child0 = new CSSNode(); root_child0.setFlexGrow(1f); - root_child0.setMargin(CSSEdge.TOP, 10f); + root_child0.setMargin(YogaEdge.TOP, 10f); root.addChildAt(root_child0, 0); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -267,7 +267,7 @@ public class CSSLayoutMarginTest { assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(90f, root_child0.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -289,9 +289,9 @@ public class CSSLayoutMarginTest { final CSSNode root_child0 = new CSSNode(); root_child0.setFlexGrow(1f); - root_child0.setMargin(CSSEdge.START, 10f); + root_child0.setMargin(YogaEdge.START, 10f); root.addChildAt(root_child0, 0); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -304,7 +304,7 @@ public class CSSLayoutMarginTest { assertEquals(90f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -321,7 +321,7 @@ public class CSSLayoutMarginTest { @Test public void test_margin_with_sibling_row() { final CSSNode root = new CSSNode(); - root.setFlexDirection(CSSFlexDirection.ROW); + root.setFlexDirection(YogaFlexDirection.ROW); root.setWidth(100f); root.setHeight(100f); @@ -332,7 +332,7 @@ public class CSSLayoutMarginTest { final CSSNode root_child1 = new CSSNode(); root_child1.setFlexGrow(1f); root.addChildAt(root_child1, 1); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -350,7 +350,7 @@ public class CSSLayoutMarginTest { assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -382,7 +382,7 @@ public class CSSLayoutMarginTest { final CSSNode root_child1 = new CSSNode(); root_child1.setFlexGrow(1f); root.addChildAt(root_child1, 1); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -400,7 +400,7 @@ public class CSSLayoutMarginTest { assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); diff --git a/java/tests/com/facebook/csslayout/CSSLayoutMinMaxDimensionTest.java b/java/tests/com/facebook/csslayout/CSSLayoutMinMaxDimensionTest.java index 56f34d61..d509e6a2 100644 --- a/java/tests/com/facebook/csslayout/CSSLayoutMinMaxDimensionTest.java +++ b/java/tests/com/facebook/csslayout/CSSLayoutMinMaxDimensionTest.java @@ -26,7 +26,7 @@ public class CSSLayoutMinMaxDimensionTest { root_child0.setMaxWidth(50f); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -39,7 +39,7 @@ public class CSSLayoutMinMaxDimensionTest { assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -56,7 +56,7 @@ public class CSSLayoutMinMaxDimensionTest { @Test public void test_max_height() { final CSSNode root = new CSSNode(); - root.setFlexDirection(CSSFlexDirection.ROW); + root.setFlexDirection(YogaFlexDirection.ROW); root.setWidth(100f); root.setHeight(100f); @@ -64,7 +64,7 @@ public class CSSLayoutMinMaxDimensionTest { root_child0.setWidth(10f); root_child0.setMaxHeight(50f); root.addChildAt(root_child0, 0); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -77,7 +77,7 @@ public class CSSLayoutMinMaxDimensionTest { assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -105,7 +105,7 @@ public class CSSLayoutMinMaxDimensionTest { final CSSNode root_child1 = new CSSNode(); root_child1.setFlexGrow(1f); root.addChildAt(root_child1, 1); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -123,7 +123,7 @@ public class CSSLayoutMinMaxDimensionTest { assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -145,7 +145,7 @@ public class CSSLayoutMinMaxDimensionTest { @Test public void test_min_width() { final CSSNode root = new CSSNode(); - root.setFlexDirection(CSSFlexDirection.ROW); + root.setFlexDirection(YogaFlexDirection.ROW); root.setWidth(100f); root.setHeight(100f); @@ -157,7 +157,7 @@ public class CSSLayoutMinMaxDimensionTest { final CSSNode root_child1 = new CSSNode(); root_child1.setFlexGrow(1f); root.addChildAt(root_child1, 1); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -175,7 +175,7 @@ public class CSSLayoutMinMaxDimensionTest { assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -197,7 +197,7 @@ public class CSSLayoutMinMaxDimensionTest { @Test public void test_justify_content_min_max() { final CSSNode root = new CSSNode(); - root.setJustifyContent(CSSJustify.CENTER); + root.setJustifyContent(YogaJustify.CENTER); root.setWidth(100f); root.setMinHeight(100f); root.setMaxHeight(200f); @@ -206,7 +206,7 @@ public class CSSLayoutMinMaxDimensionTest { root_child0.setWidth(60f); root_child0.setHeight(60f); root.addChildAt(root_child0, 0); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -219,7 +219,7 @@ public class CSSLayoutMinMaxDimensionTest { assertEquals(60f, root_child0.getLayoutWidth(), 0.0f); assertEquals(60f, root_child0.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -236,7 +236,7 @@ public class CSSLayoutMinMaxDimensionTest { @Test public void test_align_items_min_max() { final CSSNode root = new CSSNode(); - root.setAlignItems(CSSAlign.CENTER); + root.setAlignItems(YogaAlign.CENTER); root.setMinWidth(100f); root.setMaxWidth(200f); root.setHeight(100f); @@ -245,7 +245,7 @@ public class CSSLayoutMinMaxDimensionTest { root_child0.setWidth(60f); root_child0.setHeight(60f); root.addChildAt(root_child0, 0); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -258,7 +258,7 @@ public class CSSLayoutMinMaxDimensionTest { assertEquals(60f, root_child0.getLayoutWidth(), 0.0f); assertEquals(60f, root_child0.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -275,7 +275,7 @@ public class CSSLayoutMinMaxDimensionTest { @Test public void test_justify_content_overflow_min_max() { final CSSNode root = new CSSNode(); - root.setJustifyContent(CSSJustify.CENTER); + root.setJustifyContent(YogaJustify.CENTER); root.setMinHeight(100f); root.setMaxHeight(110f); @@ -293,7 +293,7 @@ public class CSSLayoutMinMaxDimensionTest { root_child2.setWidth(50f); root_child2.setHeight(50f); root.addChildAt(root_child2, 2); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -316,7 +316,7 @@ public class CSSLayoutMinMaxDimensionTest { assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); assertEquals(50f, root_child2.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -347,7 +347,7 @@ public class CSSLayoutMinMaxDimensionTest { root.setHeight(100f); final CSSNode root_child0 = new CSSNode(); - root_child0.setFlexDirection(CSSFlexDirection.ROW); + root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setMaxWidth(100f); root.addChildAt(root_child0, 0); @@ -355,7 +355,7 @@ public class CSSLayoutMinMaxDimensionTest { root_child0_child0.setFlexGrow(1f); root_child0_child0.setHeight(20f); root_child0.addChildAt(root_child0_child0, 0); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -373,7 +373,7 @@ public class CSSLayoutMinMaxDimensionTest { assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -399,7 +399,7 @@ public class CSSLayoutMinMaxDimensionTest { root.setHeight(100f); final CSSNode root_child0 = new CSSNode(); - root_child0.setFlexDirection(CSSFlexDirection.ROW); + root_child0.setFlexDirection(YogaFlexDirection.ROW); root_child0.setMaxWidth(300f); root.addChildAt(root_child0, 0); @@ -407,7 +407,7 @@ public class CSSLayoutMinMaxDimensionTest { root_child0_child0.setFlexGrow(1f); root_child0_child0.setHeight(20f); root_child0.addChildAt(root_child0_child0, 0); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -425,7 +425,7 @@ public class CSSLayoutMinMaxDimensionTest { assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); diff --git a/java/tests/com/facebook/csslayout/CSSLayoutPaddingTest.java b/java/tests/com/facebook/csslayout/CSSLayoutPaddingTest.java index f837953f..a50ac8b5 100644 --- a/java/tests/com/facebook/csslayout/CSSLayoutPaddingTest.java +++ b/java/tests/com/facebook/csslayout/CSSLayoutPaddingTest.java @@ -19,11 +19,11 @@ public class CSSLayoutPaddingTest { @Test public void test_padding_no_size() { final CSSNode root = new CSSNode(); - root.setPadding(CSSEdge.LEFT, 10); - root.setPadding(CSSEdge.TOP, 10); - root.setPadding(CSSEdge.RIGHT, 10); - root.setPadding(CSSEdge.BOTTOM, 10); - root.setDirection(CSSDirection.LTR); + root.setPadding(YogaEdge.LEFT, 10); + root.setPadding(YogaEdge.TOP, 10); + root.setPadding(YogaEdge.RIGHT, 10); + root.setPadding(YogaEdge.BOTTOM, 10); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -31,7 +31,7 @@ public class CSSLayoutPaddingTest { assertEquals(20f, root.getLayoutWidth(), 0.0f); assertEquals(20f, root.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -43,16 +43,16 @@ public class CSSLayoutPaddingTest { @Test public void test_padding_container_match_child() { final CSSNode root = new CSSNode(); - root.setPadding(CSSEdge.LEFT, 10); - root.setPadding(CSSEdge.TOP, 10); - root.setPadding(CSSEdge.RIGHT, 10); - root.setPadding(CSSEdge.BOTTOM, 10); + root.setPadding(YogaEdge.LEFT, 10); + root.setPadding(YogaEdge.TOP, 10); + root.setPadding(YogaEdge.RIGHT, 10); + root.setPadding(YogaEdge.BOTTOM, 10); final CSSNode root_child0 = new CSSNode(); root_child0.setWidth(10f); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -65,7 +65,7 @@ public class CSSLayoutPaddingTest { assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -82,10 +82,10 @@ public class CSSLayoutPaddingTest { @Test public void test_padding_flex_child() { final CSSNode root = new CSSNode(); - root.setPadding(CSSEdge.LEFT, 10); - root.setPadding(CSSEdge.TOP, 10); - root.setPadding(CSSEdge.RIGHT, 10); - root.setPadding(CSSEdge.BOTTOM, 10); + root.setPadding(YogaEdge.LEFT, 10); + root.setPadding(YogaEdge.TOP, 10); + root.setPadding(YogaEdge.RIGHT, 10); + root.setPadding(YogaEdge.BOTTOM, 10); root.setWidth(100f); root.setHeight(100f); @@ -93,7 +93,7 @@ public class CSSLayoutPaddingTest { root_child0.setFlexGrow(1f); root_child0.setWidth(10f); root.addChildAt(root_child0, 0); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -106,7 +106,7 @@ public class CSSLayoutPaddingTest { assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(80f, root_child0.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -123,17 +123,17 @@ public class CSSLayoutPaddingTest { @Test public void test_padding_stretch_child() { final CSSNode root = new CSSNode(); - root.setPadding(CSSEdge.LEFT, 10); - root.setPadding(CSSEdge.TOP, 10); - root.setPadding(CSSEdge.RIGHT, 10); - root.setPadding(CSSEdge.BOTTOM, 10); + root.setPadding(YogaEdge.LEFT, 10); + root.setPadding(YogaEdge.TOP, 10); + root.setPadding(YogaEdge.RIGHT, 10); + root.setPadding(YogaEdge.BOTTOM, 10); root.setWidth(100f); root.setHeight(100f); final CSSNode root_child0 = new CSSNode(); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -146,7 +146,7 @@ public class CSSLayoutPaddingTest { assertEquals(80f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -163,11 +163,11 @@ public class CSSLayoutPaddingTest { @Test public void test_padding_center_child() { final CSSNode root = new CSSNode(); - root.setJustifyContent(CSSJustify.CENTER); - root.setAlignItems(CSSAlign.CENTER); - root.setPadding(CSSEdge.START, 10); - root.setPadding(CSSEdge.END, 20); - root.setPadding(CSSEdge.BOTTOM, 20); + root.setJustifyContent(YogaJustify.CENTER); + root.setAlignItems(YogaAlign.CENTER); + root.setPadding(YogaEdge.START, 10); + root.setPadding(YogaEdge.END, 20); + root.setPadding(YogaEdge.BOTTOM, 20); root.setWidth(100f); root.setHeight(100f); @@ -175,7 +175,7 @@ public class CSSLayoutPaddingTest { root_child0.setWidth(10f); root_child0.setHeight(10f); root.addChildAt(root_child0, 0); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -188,7 +188,7 @@ public class CSSLayoutPaddingTest { assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -205,20 +205,20 @@ public class CSSLayoutPaddingTest { @Test public void test_child_with_padding_align_end() { final CSSNode root = new CSSNode(); - root.setJustifyContent(CSSJustify.FLEX_END); - root.setAlignItems(CSSAlign.FLEX_END); + root.setJustifyContent(YogaJustify.FLEX_END); + root.setAlignItems(YogaAlign.FLEX_END); root.setWidth(200f); root.setHeight(200f); final CSSNode root_child0 = new CSSNode(); - root_child0.setPadding(CSSEdge.LEFT, 20); - root_child0.setPadding(CSSEdge.TOP, 20); - root_child0.setPadding(CSSEdge.RIGHT, 20); - root_child0.setPadding(CSSEdge.BOTTOM, 20); + root_child0.setPadding(YogaEdge.LEFT, 20); + root_child0.setPadding(YogaEdge.TOP, 20); + root_child0.setPadding(YogaEdge.RIGHT, 20); + root_child0.setPadding(YogaEdge.BOTTOM, 20); root_child0.setWidth(100f); root_child0.setHeight(100f); root.addChildAt(root_child0, 0); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -231,7 +231,7 @@ public class CSSLayoutPaddingTest { assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); diff --git a/java/tests/com/facebook/csslayout/CSSLayoutRoundingTest.java b/java/tests/com/facebook/csslayout/CSSLayoutRoundingTest.java index 17587908..e3e6543b 100644 --- a/java/tests/com/facebook/csslayout/CSSLayoutRoundingTest.java +++ b/java/tests/com/facebook/csslayout/CSSLayoutRoundingTest.java @@ -18,10 +18,10 @@ import static org.junit.Assert.assertEquals; public class CSSLayoutRoundingTest { @Test public void test_rounding_flex_basis_flex_grow_row_width_of_100() { - CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true); + CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true); final CSSNode root = new CSSNode(); - root.setFlexDirection(CSSFlexDirection.ROW); + root.setFlexDirection(YogaFlexDirection.ROW); root.setWidth(100f); root.setHeight(100f); @@ -36,7 +36,7 @@ public class CSSLayoutRoundingTest { final CSSNode root_child2 = new CSSNode(); root_child2.setFlexGrow(1f); root.addChildAt(root_child2, 2); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -59,7 +59,7 @@ public class CSSLayoutRoundingTest { assertEquals(33f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -82,15 +82,15 @@ public class CSSLayoutRoundingTest { assertEquals(33f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); - CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false); + CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false); } @Test public void test_rounding_flex_basis_flex_grow_row_prime_number_width() { - CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true); + CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true); final CSSNode root = new CSSNode(); - root.setFlexDirection(CSSFlexDirection.ROW); + root.setFlexDirection(YogaFlexDirection.ROW); root.setWidth(113f); root.setHeight(100f); @@ -113,7 +113,7 @@ public class CSSLayoutRoundingTest { final CSSNode root_child4 = new CSSNode(); root_child4.setFlexGrow(1f); root.addChildAt(root_child4, 4); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -146,7 +146,7 @@ public class CSSLayoutRoundingTest { assertEquals(23f, root_child4.getLayoutWidth(), 0.0f); assertEquals(100f, root_child4.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -179,15 +179,15 @@ public class CSSLayoutRoundingTest { assertEquals(23f, root_child4.getLayoutWidth(), 0.0f); assertEquals(100f, root_child4.getLayoutHeight(), 0.0f); - CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false); + CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false); } @Test public void test_rounding_flex_basis_flex_shrink_row() { - CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true); + CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true); final CSSNode root = new CSSNode(); - root.setFlexDirection(CSSFlexDirection.ROW); + root.setFlexDirection(YogaFlexDirection.ROW); root.setWidth(101f); root.setHeight(100f); @@ -203,7 +203,7 @@ public class CSSLayoutRoundingTest { final CSSNode root_child2 = new CSSNode(); root_child2.setFlexBasis(25f); root.addChildAt(root_child2, 2); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -226,7 +226,7 @@ public class CSSLayoutRoundingTest { assertEquals(25f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -249,12 +249,12 @@ public class CSSLayoutRoundingTest { assertEquals(25f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); - CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false); + CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false); } @Test public void test_rounding_flex_basis_overrides_main_size() { - CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true); + CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true); final CSSNode root = new CSSNode(); root.setWidth(100f); @@ -275,7 +275,7 @@ public class CSSLayoutRoundingTest { root_child2.setFlexGrow(1f); root_child2.setHeight(10f); root.addChildAt(root_child2, 2); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -298,7 +298,7 @@ public class CSSLayoutRoundingTest { assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(24f, root_child2.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -321,12 +321,12 @@ public class CSSLayoutRoundingTest { assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(24f, root_child2.getLayoutHeight(), 0.0f); - CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false); + CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false); } @Test public void test_rounding_total_fractial() { - CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true); + CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true); final CSSNode root = new CSSNode(); root.setWidth(87.4f); @@ -347,7 +347,7 @@ public class CSSLayoutRoundingTest { root_child2.setFlexGrow(1.1f); root_child2.setHeight(10.7f); root.addChildAt(root_child2, 2); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -370,7 +370,7 @@ public class CSSLayoutRoundingTest { assertEquals(87f, root_child2.getLayoutWidth(), 0.0f); assertEquals(24f, root_child2.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -393,12 +393,12 @@ public class CSSLayoutRoundingTest { assertEquals(87f, root_child2.getLayoutWidth(), 0.0f); assertEquals(24f, root_child2.getLayoutHeight(), 0.0f); - CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false); + CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false); } @Test public void test_rounding_total_fractial_nested() { - CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true); + CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true); final CSSNode root = new CSSNode(); root.setWidth(87.4f); @@ -413,14 +413,14 @@ public class CSSLayoutRoundingTest { final CSSNode root_child0_child0 = new CSSNode(); root_child0_child0.setFlexGrow(1f); root_child0_child0.setFlexBasis(0.3f); - root_child0_child0.setPosition(CSSEdge.BOTTOM, 13.3f); + root_child0_child0.setPosition(YogaEdge.BOTTOM, 13.3f); root_child0_child0.setHeight(9.9f); root_child0.addChildAt(root_child0_child0, 0); final CSSNode root_child0_child1 = new CSSNode(); root_child0_child1.setFlexGrow(4f); root_child0_child1.setFlexBasis(0.3f); - root_child0_child1.setPosition(CSSEdge.TOP, 13.3f); + root_child0_child1.setPosition(YogaEdge.TOP, 13.3f); root_child0_child1.setHeight(1.1f); root_child0.addChildAt(root_child0_child1, 1); @@ -433,7 +433,7 @@ public class CSSLayoutRoundingTest { root_child2.setFlexGrow(1.1f); root_child2.setHeight(10.7f); root.addChildAt(root_child2, 2); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -466,7 +466,7 @@ public class CSSLayoutRoundingTest { assertEquals(87f, root_child2.getLayoutWidth(), 0.0f); assertEquals(24f, root_child2.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -499,12 +499,12 @@ public class CSSLayoutRoundingTest { assertEquals(87f, root_child2.getLayoutWidth(), 0.0f); assertEquals(24f, root_child2.getLayoutHeight(), 0.0f); - CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false); + CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false); } @Test public void test_rounding_fractial_input_1() { - CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true); + CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true); final CSSNode root = new CSSNode(); root.setWidth(100f); @@ -525,7 +525,7 @@ public class CSSLayoutRoundingTest { root_child2.setFlexGrow(1f); root_child2.setHeight(10f); root.addChildAt(root_child2, 2); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -548,7 +548,7 @@ public class CSSLayoutRoundingTest { assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(24f, root_child2.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -571,12 +571,12 @@ public class CSSLayoutRoundingTest { assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(24f, root_child2.getLayoutHeight(), 0.0f); - CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false); + CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false); } @Test public void test_rounding_fractial_input_2() { - CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true); + CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true); final CSSNode root = new CSSNode(); root.setWidth(100f); @@ -597,7 +597,7 @@ public class CSSLayoutRoundingTest { root_child2.setFlexGrow(1f); root_child2.setHeight(10f); root.addChildAt(root_child2, 2); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -620,7 +620,7 @@ public class CSSLayoutRoundingTest { assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(25f, root_child2.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -643,15 +643,15 @@ public class CSSLayoutRoundingTest { assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(25f, root_child2.getLayoutHeight(), 0.0f); - CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false); + CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false); } @Test public void test_rounding_fractial_input_3() { - CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true); + CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true); final CSSNode root = new CSSNode(); - root.setPosition(CSSEdge.TOP, 0.3f); + root.setPosition(YogaEdge.TOP, 0.3f); root.setWidth(100f); root.setHeight(113.4f); @@ -670,7 +670,7 @@ public class CSSLayoutRoundingTest { root_child2.setFlexGrow(1f); root_child2.setHeight(10f); root.addChildAt(root_child2, 2); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -693,7 +693,7 @@ public class CSSLayoutRoundingTest { assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(24f, root_child2.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -716,15 +716,15 @@ public class CSSLayoutRoundingTest { assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(24f, root_child2.getLayoutHeight(), 0.0f); - CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false); + CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false); } @Test public void test_rounding_fractial_input_4() { - CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true); + CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true); final CSSNode root = new CSSNode(); - root.setPosition(CSSEdge.TOP, 0.7f); + root.setPosition(YogaEdge.TOP, 0.7f); root.setWidth(100f); root.setHeight(113.4f); @@ -743,7 +743,7 @@ public class CSSLayoutRoundingTest { root_child2.setFlexGrow(1f); root_child2.setHeight(10f); root.addChildAt(root_child2, 2); - root.setDirection(CSSDirection.LTR); + root.setDirection(YogaDirection.LTR); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -766,7 +766,7 @@ public class CSSLayoutRoundingTest { assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(24f, root_child2.getLayoutHeight(), 0.0f); - root.setDirection(CSSDirection.RTL); + root.setDirection(YogaDirection.RTL); root.calculateLayout(); assertEquals(0f, root.getLayoutX(), 0.0f); @@ -789,7 +789,7 @@ public class CSSLayoutRoundingTest { assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(24f, root_child2.getLayoutHeight(), 0.0f); - CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false); + CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false); } } diff --git a/java/tests/com/facebook/csslayout/CSSNodeTest.java b/java/tests/com/facebook/csslayout/CSSNodeTest.java index 48abed92..70eb8ce5 100644 --- a/java/tests/com/facebook/csslayout/CSSNodeTest.java +++ b/java/tests/com/facebook/csslayout/CSSNodeTest.java @@ -30,9 +30,9 @@ public class CSSNodeTest { public long measure( CSSNodeAPI node, float width, - CSSMeasureMode widthMode, + YogaMeasureMode widthMode, float height, - CSSMeasureMode heightMode) { + YogaMeasureMode heightMode) { return MeasureOutput.make(100, 100); } }); @@ -41,42 +41,42 @@ public class CSSNodeTest { assertEquals(100, (int) node.getLayoutHeight()); } - private CSSLogLevel mLogLevel; + private YogaLogLevel mLogLevel; private String mLogMessage; @Test public void testLogger() { CSSNode.setLogger(new CSSLogger() { - public void log(CSSLogLevel level, String message) { + public void log(YogaLogLevel level, String message) { mLogLevel = level; mLogMessage = message; } }); - CSSNode.jni_CSSLog(CSSLogLevel.DEBUG.intValue(), "Hello"); - assertEquals(CSSLogLevel.DEBUG, mLogLevel); + CSSNode.jni_CSSLog(YogaLogLevel.DEBUG.intValue(), "Hello"); + assertEquals(YogaLogLevel.DEBUG, mLogLevel); assertEquals("Hello", mLogMessage); } @Test public void testUpdateLogger() { CSSNode.setLogger(new CSSLogger() { - public void log(CSSLogLevel level, String message) {} + public void log(YogaLogLevel level, String message) {} }); CSSNode.setLogger(new CSSLogger() { - public void log(CSSLogLevel level, String message) { + public void log(YogaLogLevel level, String message) { mLogLevel = level; mLogMessage = message; } }); - CSSNode.jni_CSSLog(CSSLogLevel.VERBOSE.intValue(), "Flexbox"); - assertEquals(CSSLogLevel.VERBOSE, mLogLevel); + CSSNode.jni_CSSLog(YogaLogLevel.VERBOSE.intValue(), "Flexbox"); + assertEquals(YogaLogLevel.VERBOSE, mLogLevel); assertEquals("Flexbox", mLogMessage); } @Test public void testCopyStyle() { final CSSNode node0 = new CSSNode(); - assertTrue(CSSConstants.isUndefined(node0.getMaxHeight())); + assertTrue(YogaConstants.isUndefined(node0.getMaxHeight())); final CSSNode node1 = new CSSNode(); node1.setMaxHeight(100); diff --git a/tests/CSSLayoutAbsolutePositionTest.cpp b/tests/CSSLayoutAbsolutePositionTest.cpp index a0bedbe5..4e5bca75 100644 --- a/tests/CSSLayoutAbsolutePositionTest.cpp +++ b/tests/CSSLayoutAbsolutePositionTest.cpp @@ -18,13 +18,13 @@ TEST(CSSLayoutTest, absolute_layout_width_height_start_top) { CSSNodeStyleSetHeight(root, 100); const CSSNodeRef root_child0 = CSSNodeNew(); - CSSNodeStyleSetPositionType(root_child0, CSSPositionTypeAbsolute); - CSSNodeStyleSetPosition(root_child0, CSSEdgeStart, 10); - CSSNodeStyleSetPosition(root_child0, CSSEdgeTop, 10); + CSSNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute); + CSSNodeStyleSetPosition(root_child0, YGEdgeStart, 10); + CSSNodeStyleSetPosition(root_child0, YGEdgeTop, 10); CSSNodeStyleSetWidth(root_child0, 10); CSSNodeStyleSetHeight(root_child0, 10); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -36,7 +36,7 @@ TEST(CSSLayoutTest, absolute_layout_width_height_start_top) { ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -57,13 +57,13 @@ TEST(CSSLayoutTest, absolute_layout_width_height_end_bottom) { CSSNodeStyleSetHeight(root, 100); const CSSNodeRef root_child0 = CSSNodeNew(); - CSSNodeStyleSetPositionType(root_child0, CSSPositionTypeAbsolute); - CSSNodeStyleSetPosition(root_child0, CSSEdgeEnd, 10); - CSSNodeStyleSetPosition(root_child0, CSSEdgeBottom, 10); + CSSNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute); + CSSNodeStyleSetPosition(root_child0, YGEdgeEnd, 10); + CSSNodeStyleSetPosition(root_child0, YGEdgeBottom, 10); CSSNodeStyleSetWidth(root_child0, 10); CSSNodeStyleSetHeight(root_child0, 10); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -75,7 +75,7 @@ TEST(CSSLayoutTest, absolute_layout_width_height_end_bottom) { ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -96,13 +96,13 @@ TEST(CSSLayoutTest, absolute_layout_start_top_end_bottom) { CSSNodeStyleSetHeight(root, 100); const CSSNodeRef root_child0 = CSSNodeNew(); - CSSNodeStyleSetPositionType(root_child0, CSSPositionTypeAbsolute); - CSSNodeStyleSetPosition(root_child0, CSSEdgeStart, 10); - CSSNodeStyleSetPosition(root_child0, CSSEdgeTop, 10); - CSSNodeStyleSetPosition(root_child0, CSSEdgeEnd, 10); - CSSNodeStyleSetPosition(root_child0, CSSEdgeBottom, 10); + CSSNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute); + CSSNodeStyleSetPosition(root_child0, YGEdgeStart, 10); + CSSNodeStyleSetPosition(root_child0, YGEdgeTop, 10); + CSSNodeStyleSetPosition(root_child0, YGEdgeEnd, 10); + CSSNodeStyleSetPosition(root_child0, YGEdgeBottom, 10); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -114,7 +114,7 @@ TEST(CSSLayoutTest, absolute_layout_start_top_end_bottom) { ASSERT_FLOAT_EQ(80, CSSNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(80, CSSNodeLayoutGetHeight(root_child0)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -135,15 +135,15 @@ TEST(CSSLayoutTest, absolute_layout_width_height_start_top_end_bottom) { CSSNodeStyleSetHeight(root, 100); const CSSNodeRef root_child0 = CSSNodeNew(); - CSSNodeStyleSetPositionType(root_child0, CSSPositionTypeAbsolute); - CSSNodeStyleSetPosition(root_child0, CSSEdgeStart, 10); - CSSNodeStyleSetPosition(root_child0, CSSEdgeTop, 10); - CSSNodeStyleSetPosition(root_child0, CSSEdgeEnd, 10); - CSSNodeStyleSetPosition(root_child0, CSSEdgeBottom, 10); + CSSNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute); + CSSNodeStyleSetPosition(root_child0, YGEdgeStart, 10); + CSSNodeStyleSetPosition(root_child0, YGEdgeTop, 10); + CSSNodeStyleSetPosition(root_child0, YGEdgeEnd, 10); + CSSNodeStyleSetPosition(root_child0, YGEdgeBottom, 10); CSSNodeStyleSetWidth(root_child0, 10); CSSNodeStyleSetHeight(root_child0, 10); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -155,7 +155,7 @@ TEST(CSSLayoutTest, absolute_layout_width_height_start_top_end_bottom) { ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -172,22 +172,22 @@ TEST(CSSLayoutTest, absolute_layout_width_height_start_top_end_bottom) { TEST(CSSLayoutTest, do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); - CSSNodeStyleSetOverflow(root, CSSOverflowHidden); + CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow); + CSSNodeStyleSetOverflow(root, YGOverflowHidden); CSSNodeStyleSetWidth(root, 50); CSSNodeStyleSetHeight(root, 50); const CSSNodeRef root_child0 = CSSNodeNew(); - CSSNodeStyleSetPositionType(root_child0, CSSPositionTypeAbsolute); - CSSNodeStyleSetPosition(root_child0, CSSEdgeStart, 0); - CSSNodeStyleSetPosition(root_child0, CSSEdgeTop, 0); + CSSNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute); + CSSNodeStyleSetPosition(root_child0, YGEdgeStart, 0); + CSSNodeStyleSetPosition(root_child0, YGEdgeTop, 0); CSSNodeInsertChild(root, root_child0, 0); const CSSNodeRef root_child0_child0 = CSSNodeNew(); CSSNodeStyleSetWidth(root_child0_child0, 100); CSSNodeStyleSetHeight(root_child0_child0, 100); CSSNodeInsertChild(root_child0, root_child0_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -204,7 +204,7 @@ TEST(CSSLayoutTest, do_not_clamp_height_of_absolute_node_to_height_of_its_overfl ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child0_child0)); ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child0_child0)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -226,37 +226,37 @@ TEST(CSSLayoutTest, do_not_clamp_height_of_absolute_node_to_height_of_its_overfl TEST(CSSLayoutTest, absolute_layout_within_border) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetMargin(root, CSSEdgeLeft, 10); - CSSNodeStyleSetMargin(root, CSSEdgeTop, 10); - CSSNodeStyleSetMargin(root, CSSEdgeRight, 10); - CSSNodeStyleSetMargin(root, CSSEdgeBottom, 10); - CSSNodeStyleSetPadding(root, CSSEdgeLeft, 10); - CSSNodeStyleSetPadding(root, CSSEdgeTop, 10); - CSSNodeStyleSetPadding(root, CSSEdgeRight, 10); - CSSNodeStyleSetPadding(root, CSSEdgeBottom, 10); - CSSNodeStyleSetBorder(root, CSSEdgeLeft, 10); - CSSNodeStyleSetBorder(root, CSSEdgeTop, 10); - CSSNodeStyleSetBorder(root, CSSEdgeRight, 10); - CSSNodeStyleSetBorder(root, CSSEdgeBottom, 10); + CSSNodeStyleSetMargin(root, YGEdgeLeft, 10); + CSSNodeStyleSetMargin(root, YGEdgeTop, 10); + CSSNodeStyleSetMargin(root, YGEdgeRight, 10); + CSSNodeStyleSetMargin(root, YGEdgeBottom, 10); + CSSNodeStyleSetPadding(root, YGEdgeLeft, 10); + CSSNodeStyleSetPadding(root, YGEdgeTop, 10); + CSSNodeStyleSetPadding(root, YGEdgeRight, 10); + CSSNodeStyleSetPadding(root, YGEdgeBottom, 10); + CSSNodeStyleSetBorder(root, YGEdgeLeft, 10); + CSSNodeStyleSetBorder(root, YGEdgeTop, 10); + CSSNodeStyleSetBorder(root, YGEdgeRight, 10); + CSSNodeStyleSetBorder(root, YGEdgeBottom, 10); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); const CSSNodeRef root_child0 = CSSNodeNew(); - CSSNodeStyleSetPositionType(root_child0, CSSPositionTypeAbsolute); - CSSNodeStyleSetPosition(root_child0, CSSEdgeLeft, 0); - CSSNodeStyleSetPosition(root_child0, CSSEdgeTop, 0); + CSSNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute); + CSSNodeStyleSetPosition(root_child0, YGEdgeLeft, 0); + CSSNodeStyleSetPosition(root_child0, YGEdgeTop, 0); CSSNodeStyleSetWidth(root_child0, 50); CSSNodeStyleSetHeight(root_child0, 50); CSSNodeInsertChild(root, root_child0, 0); const CSSNodeRef root_child1 = CSSNodeNew(); - CSSNodeStyleSetPositionType(root_child1, CSSPositionTypeAbsolute); - CSSNodeStyleSetPosition(root_child1, CSSEdgeRight, 0); - CSSNodeStyleSetPosition(root_child1, CSSEdgeBottom, 0); + CSSNodeStyleSetPositionType(root_child1, YGPositionTypeAbsolute); + CSSNodeStyleSetPosition(root_child1, YGEdgeRight, 0); + CSSNodeStyleSetPosition(root_child1, YGEdgeBottom, 0); CSSNodeStyleSetWidth(root_child1, 50); CSSNodeStyleSetHeight(root_child1, 50); CSSNodeInsertChild(root, root_child1, 1); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetTop(root)); @@ -273,7 +273,7 @@ TEST(CSSLayoutTest, absolute_layout_within_border) { ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetWidth(root_child1)); ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetHeight(root_child1)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetTop(root)); diff --git a/tests/CSSLayoutAlignContentTest.cpp b/tests/CSSLayoutAlignContentTest.cpp index d3078098..eb0daa57 100644 --- a/tests/CSSLayoutAlignContentTest.cpp +++ b/tests/CSSLayoutAlignContentTest.cpp @@ -14,7 +14,7 @@ TEST(CSSLayoutTest, align_content_flex_start) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetFlexWrap(root, CSSWrapWrap); + CSSNodeStyleSetFlexWrap(root, YGWrapWrap); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -42,7 +42,7 @@ TEST(CSSLayoutTest, align_content_flex_start) { CSSNodeStyleSetWidth(root_child4, 50); CSSNodeStyleSetHeight(root_child4, 10); CSSNodeInsertChild(root, root_child4, 4); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -74,7 +74,7 @@ TEST(CSSLayoutTest, align_content_flex_start) { ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetWidth(root_child4)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child4)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -111,8 +111,8 @@ TEST(CSSLayoutTest, align_content_flex_start) { TEST(CSSLayoutTest, align_content_flex_end) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetAlignContent(root, CSSAlignFlexEnd); - CSSNodeStyleSetFlexWrap(root, CSSWrapWrap); + CSSNodeStyleSetAlignContent(root, YGAlignFlexEnd); + CSSNodeStyleSetFlexWrap(root, YGWrapWrap); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -140,7 +140,7 @@ TEST(CSSLayoutTest, align_content_flex_end) { CSSNodeStyleSetWidth(root_child4, 50); CSSNodeStyleSetHeight(root_child4, 10); CSSNodeInsertChild(root, root_child4, 4); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -172,7 +172,7 @@ TEST(CSSLayoutTest, align_content_flex_end) { ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetWidth(root_child4)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child4)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -209,8 +209,8 @@ TEST(CSSLayoutTest, align_content_flex_end) { TEST(CSSLayoutTest, align_content_center) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetAlignContent(root, CSSAlignCenter); - CSSNodeStyleSetFlexWrap(root, CSSWrapWrap); + CSSNodeStyleSetAlignContent(root, YGAlignCenter); + CSSNodeStyleSetFlexWrap(root, YGWrapWrap); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -238,7 +238,7 @@ TEST(CSSLayoutTest, align_content_center) { CSSNodeStyleSetWidth(root_child4, 50); CSSNodeStyleSetHeight(root_child4, 10); CSSNodeInsertChild(root, root_child4, 4); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -270,7 +270,7 @@ TEST(CSSLayoutTest, align_content_center) { ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetWidth(root_child4)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child4)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -307,8 +307,8 @@ TEST(CSSLayoutTest, align_content_center) { TEST(CSSLayoutTest, align_content_stretch) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetAlignContent(root, CSSAlignStretch); - CSSNodeStyleSetFlexWrap(root, CSSWrapWrap); + CSSNodeStyleSetAlignContent(root, YGAlignStretch); + CSSNodeStyleSetFlexWrap(root, YGWrapWrap); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -331,7 +331,7 @@ TEST(CSSLayoutTest, align_content_stretch) { const CSSNodeRef root_child4 = CSSNodeNew(); CSSNodeStyleSetWidth(root_child4, 50); CSSNodeInsertChild(root, root_child4, 4); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -363,7 +363,7 @@ TEST(CSSLayoutTest, align_content_stretch) { ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetWidth(root_child4)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetHeight(root_child4)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); diff --git a/tests/CSSLayoutAlignItemsTest.cpp b/tests/CSSLayoutAlignItemsTest.cpp index c72acc7a..5c8db2c0 100644 --- a/tests/CSSLayoutAlignItemsTest.cpp +++ b/tests/CSSLayoutAlignItemsTest.cpp @@ -20,7 +20,7 @@ TEST(CSSLayoutTest, align_items_stretch) { const CSSNodeRef root_child0 = CSSNodeNew(); CSSNodeStyleSetHeight(root_child0, 10); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -32,7 +32,7 @@ TEST(CSSLayoutTest, align_items_stretch) { ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -49,7 +49,7 @@ TEST(CSSLayoutTest, align_items_stretch) { TEST(CSSLayoutTest, align_items_center) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetAlignItems(root, CSSAlignCenter); + CSSNodeStyleSetAlignItems(root, YGAlignCenter); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -57,7 +57,7 @@ TEST(CSSLayoutTest, align_items_center) { CSSNodeStyleSetWidth(root_child0, 10); CSSNodeStyleSetHeight(root_child0, 10); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -69,7 +69,7 @@ TEST(CSSLayoutTest, align_items_center) { ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -86,7 +86,7 @@ TEST(CSSLayoutTest, align_items_center) { TEST(CSSLayoutTest, align_items_flex_start) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); + CSSNodeStyleSetAlignItems(root, YGAlignFlexStart); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -94,7 +94,7 @@ TEST(CSSLayoutTest, align_items_flex_start) { CSSNodeStyleSetWidth(root_child0, 10); CSSNodeStyleSetHeight(root_child0, 10); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -106,7 +106,7 @@ TEST(CSSLayoutTest, align_items_flex_start) { ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -123,7 +123,7 @@ TEST(CSSLayoutTest, align_items_flex_start) { TEST(CSSLayoutTest, align_items_flex_end) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetAlignItems(root, CSSAlignFlexEnd); + CSSNodeStyleSetAlignItems(root, YGAlignFlexEnd); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -131,7 +131,7 @@ TEST(CSSLayoutTest, align_items_flex_end) { CSSNodeStyleSetWidth(root_child0, 10); CSSNodeStyleSetHeight(root_child0, 10); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -143,7 +143,7 @@ TEST(CSSLayoutTest, align_items_flex_end) { ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); diff --git a/tests/CSSLayoutAlignSelfTest.cpp b/tests/CSSLayoutAlignSelfTest.cpp index 6e090730..bc183398 100644 --- a/tests/CSSLayoutAlignSelfTest.cpp +++ b/tests/CSSLayoutAlignSelfTest.cpp @@ -18,11 +18,11 @@ TEST(CSSLayoutTest, align_self_center) { CSSNodeStyleSetHeight(root, 100); const CSSNodeRef root_child0 = CSSNodeNew(); - CSSNodeStyleSetAlignSelf(root_child0, CSSAlignCenter); + CSSNodeStyleSetAlignSelf(root_child0, YGAlignCenter); CSSNodeStyleSetWidth(root_child0, 10); CSSNodeStyleSetHeight(root_child0, 10); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -34,7 +34,7 @@ TEST(CSSLayoutTest, align_self_center) { ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -55,11 +55,11 @@ TEST(CSSLayoutTest, align_self_flex_end) { CSSNodeStyleSetHeight(root, 100); const CSSNodeRef root_child0 = CSSNodeNew(); - CSSNodeStyleSetAlignSelf(root_child0, CSSAlignFlexEnd); + CSSNodeStyleSetAlignSelf(root_child0, YGAlignFlexEnd); CSSNodeStyleSetWidth(root_child0, 10); CSSNodeStyleSetHeight(root_child0, 10); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -71,7 +71,7 @@ TEST(CSSLayoutTest, align_self_flex_end) { ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -92,11 +92,11 @@ TEST(CSSLayoutTest, align_self_flex_start) { CSSNodeStyleSetHeight(root, 100); const CSSNodeRef root_child0 = CSSNodeNew(); - CSSNodeStyleSetAlignSelf(root_child0, CSSAlignFlexStart); + CSSNodeStyleSetAlignSelf(root_child0, YGAlignFlexStart); CSSNodeStyleSetWidth(root_child0, 10); CSSNodeStyleSetHeight(root_child0, 10); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -108,7 +108,7 @@ TEST(CSSLayoutTest, align_self_flex_start) { ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -125,16 +125,16 @@ TEST(CSSLayoutTest, align_self_flex_start) { TEST(CSSLayoutTest, align_self_flex_end_override_flex_start) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); + CSSNodeStyleSetAlignItems(root, YGAlignFlexStart); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); const CSSNodeRef root_child0 = CSSNodeNew(); - CSSNodeStyleSetAlignSelf(root_child0, CSSAlignFlexEnd); + CSSNodeStyleSetAlignSelf(root_child0, YGAlignFlexEnd); CSSNodeStyleSetWidth(root_child0, 10); CSSNodeStyleSetHeight(root_child0, 10); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -146,7 +146,7 @@ TEST(CSSLayoutTest, align_self_flex_end_override_flex_start) { ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); diff --git a/tests/CSSLayoutAspectRatioTest.cpp b/tests/CSSLayoutAspectRatioTest.cpp index e43a7707..aba09889 100644 --- a/tests/CSSLayoutAspectRatioTest.cpp +++ b/tests/CSSLayoutAspectRatioTest.cpp @@ -12,18 +12,18 @@ static CSSSize _measure(CSSNodeRef node, float width, - CSSMeasureMode widthMode, + YGMeasureMode widthMode, float height, - CSSMeasureMode heightMode) { + YGMeasureMode heightMode) { return CSSSize { - .width = widthMode == CSSMeasureModeExactly ? width : 50, - .height = heightMode == CSSMeasureModeExactly ? height : 50, + .width = widthMode == YGMeasureModeExactly ? width : 50, + .height = heightMode == YGMeasureModeExactly ? height : 50, }; } TEST(CSSLayoutTest, aspect_ratio_cross_defined) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); + CSSNodeStyleSetAlignItems(root, YGAlignFlexStart); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -32,7 +32,7 @@ TEST(CSSLayoutTest, aspect_ratio_cross_defined) { CSSNodeStyleSetAspectRatio(root_child0, 1); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0)); @@ -44,7 +44,7 @@ TEST(CSSLayoutTest, aspect_ratio_cross_defined) { TEST(CSSLayoutTest, aspect_ratio_main_defined) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); + CSSNodeStyleSetAlignItems(root, YGAlignFlexStart); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -53,7 +53,7 @@ TEST(CSSLayoutTest, aspect_ratio_main_defined) { CSSNodeStyleSetAspectRatio(root_child0, 1); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0)); @@ -73,7 +73,7 @@ TEST(CSSLayoutTest, aspect_ratio_both_dimensions_defined) { CSSNodeStyleSetAspectRatio(root_child0, 1); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0)); @@ -92,7 +92,7 @@ TEST(CSSLayoutTest, aspect_ratio_align_stretch) { CSSNodeStyleSetAspectRatio(root_child0, 1); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0)); @@ -104,7 +104,7 @@ TEST(CSSLayoutTest, aspect_ratio_align_stretch) { TEST(CSSLayoutTest, aspect_ratio_flex_grow) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); + CSSNodeStyleSetAlignItems(root, YGAlignFlexStart); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -114,7 +114,7 @@ TEST(CSSLayoutTest, aspect_ratio_flex_grow) { CSSNodeStyleSetAspectRatio(root_child0, 1); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0)); @@ -126,7 +126,7 @@ TEST(CSSLayoutTest, aspect_ratio_flex_grow) { TEST(CSSLayoutTest, aspect_ratio_flex_shrink) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); + CSSNodeStyleSetAlignItems(root, YGAlignFlexStart); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -136,7 +136,7 @@ TEST(CSSLayoutTest, aspect_ratio_flex_shrink) { CSSNodeStyleSetAspectRatio(root_child0, 1); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0)); @@ -148,7 +148,7 @@ TEST(CSSLayoutTest, aspect_ratio_flex_shrink) { TEST(CSSLayoutTest, aspect_ratio_basis) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); + CSSNodeStyleSetAlignItems(root, YGAlignFlexStart); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -157,7 +157,7 @@ TEST(CSSLayoutTest, aspect_ratio_basis) { CSSNodeStyleSetAspectRatio(root_child0, 1); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0)); @@ -173,14 +173,14 @@ TEST(CSSLayoutTest, aspect_ratio_absolute_layout_width_defined) { CSSNodeStyleSetHeight(root, 100); const CSSNodeRef root_child0 = CSSNodeNew(); - CSSNodeStyleSetPositionType(root_child0, CSSPositionTypeAbsolute); - CSSNodeStyleSetPosition(root_child0, CSSEdgeLeft, 0); - CSSNodeStyleSetPosition(root_child0, CSSEdgeTop, 0); + CSSNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute); + CSSNodeStyleSetPosition(root_child0, YGEdgeLeft, 0); + CSSNodeStyleSetPosition(root_child0, YGEdgeTop, 0); CSSNodeStyleSetWidth(root_child0, 50); CSSNodeStyleSetAspectRatio(root_child0, 1); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0)); @@ -196,14 +196,14 @@ TEST(CSSLayoutTest, aspect_ratio_absolute_layout_height_defined) { CSSNodeStyleSetHeight(root, 100); const CSSNodeRef root_child0 = CSSNodeNew(); - CSSNodeStyleSetPositionType(root_child0, CSSPositionTypeAbsolute); - CSSNodeStyleSetPosition(root_child0, CSSEdgeLeft, 0); - CSSNodeStyleSetPosition(root_child0, CSSEdgeTop, 0); + CSSNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute); + CSSNodeStyleSetPosition(root_child0, YGEdgeLeft, 0); + CSSNodeStyleSetPosition(root_child0, YGEdgeTop, 0); CSSNodeStyleSetHeight(root_child0, 50); CSSNodeStyleSetAspectRatio(root_child0, 1); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0)); @@ -215,7 +215,7 @@ TEST(CSSLayoutTest, aspect_ratio_absolute_layout_height_defined) { TEST(CSSLayoutTest, aspect_ratio_with_max_cross_defined) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); + CSSNodeStyleSetAlignItems(root, YGAlignFlexStart); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -225,7 +225,7 @@ TEST(CSSLayoutTest, aspect_ratio_with_max_cross_defined) { CSSNodeStyleSetAspectRatio(root_child0, 1); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0)); @@ -237,7 +237,7 @@ TEST(CSSLayoutTest, aspect_ratio_with_max_cross_defined) { TEST(CSSLayoutTest, aspect_ratio_with_max_main_defined) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); + CSSNodeStyleSetAlignItems(root, YGAlignFlexStart); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -247,7 +247,7 @@ TEST(CSSLayoutTest, aspect_ratio_with_max_main_defined) { CSSNodeStyleSetAspectRatio(root_child0, 1); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0)); @@ -259,7 +259,7 @@ TEST(CSSLayoutTest, aspect_ratio_with_max_main_defined) { TEST(CSSLayoutTest, aspect_ratio_with_min_cross_defined) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); + CSSNodeStyleSetAlignItems(root, YGAlignFlexStart); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -269,7 +269,7 @@ TEST(CSSLayoutTest, aspect_ratio_with_min_cross_defined) { CSSNodeStyleSetAspectRatio(root_child0, 1); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0)); @@ -281,7 +281,7 @@ TEST(CSSLayoutTest, aspect_ratio_with_min_cross_defined) { TEST(CSSLayoutTest, aspect_ratio_with_min_main_defined) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); + CSSNodeStyleSetAlignItems(root, YGAlignFlexStart); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -291,7 +291,7 @@ TEST(CSSLayoutTest, aspect_ratio_with_min_main_defined) { CSSNodeStyleSetAspectRatio(root_child0, 1); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0)); @@ -303,7 +303,7 @@ TEST(CSSLayoutTest, aspect_ratio_with_min_main_defined) { TEST(CSSLayoutTest, aspect_ratio_double_cross) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); + CSSNodeStyleSetAlignItems(root, YGAlignFlexStart); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -312,7 +312,7 @@ TEST(CSSLayoutTest, aspect_ratio_double_cross) { CSSNodeStyleSetAspectRatio(root_child0, 2); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0)); @@ -324,7 +324,7 @@ TEST(CSSLayoutTest, aspect_ratio_double_cross) { TEST(CSSLayoutTest, aspect_ratio_half_cross) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); + CSSNodeStyleSetAlignItems(root, YGAlignFlexStart); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -333,7 +333,7 @@ TEST(CSSLayoutTest, aspect_ratio_half_cross) { CSSNodeStyleSetAspectRatio(root_child0, 0.5); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0)); @@ -345,7 +345,7 @@ TEST(CSSLayoutTest, aspect_ratio_half_cross) { TEST(CSSLayoutTest, aspect_ratio_double_main) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); + CSSNodeStyleSetAlignItems(root, YGAlignFlexStart); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -354,7 +354,7 @@ TEST(CSSLayoutTest, aspect_ratio_double_main) { CSSNodeStyleSetAspectRatio(root_child0, 2); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0)); @@ -366,7 +366,7 @@ TEST(CSSLayoutTest, aspect_ratio_double_main) { TEST(CSSLayoutTest, aspect_ratio_half_main) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); + CSSNodeStyleSetAlignItems(root, YGAlignFlexStart); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -375,7 +375,7 @@ TEST(CSSLayoutTest, aspect_ratio_half_main) { CSSNodeStyleSetAspectRatio(root_child0, 0.5); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0)); @@ -387,7 +387,7 @@ TEST(CSSLayoutTest, aspect_ratio_half_main) { TEST(CSSLayoutTest, aspect_ratio_with_measure_func) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); + CSSNodeStyleSetAlignItems(root, YGAlignFlexStart); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -396,7 +396,7 @@ TEST(CSSLayoutTest, aspect_ratio_with_measure_func) { CSSNodeStyleSetAspectRatio(root_child0, 1); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0)); diff --git a/tests/CSSLayoutBorderTest.cpp b/tests/CSSLayoutBorderTest.cpp index 56dac071..42818c36 100644 --- a/tests/CSSLayoutBorderTest.cpp +++ b/tests/CSSLayoutBorderTest.cpp @@ -14,18 +14,18 @@ TEST(CSSLayoutTest, border_no_size) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetBorder(root, CSSEdgeLeft, 10); - CSSNodeStyleSetBorder(root, CSSEdgeTop, 10); - CSSNodeStyleSetBorder(root, CSSEdgeRight, 10); - CSSNodeStyleSetBorder(root, CSSEdgeBottom, 10); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeStyleSetBorder(root, YGEdgeLeft, 10); + CSSNodeStyleSetBorder(root, YGEdgeTop, 10); + CSSNodeStyleSetBorder(root, YGEdgeRight, 10); + CSSNodeStyleSetBorder(root, YGEdgeBottom, 10); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetWidth(root)); ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetHeight(root)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -37,16 +37,16 @@ TEST(CSSLayoutTest, border_no_size) { TEST(CSSLayoutTest, border_container_match_child) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetBorder(root, CSSEdgeLeft, 10); - CSSNodeStyleSetBorder(root, CSSEdgeTop, 10); - CSSNodeStyleSetBorder(root, CSSEdgeRight, 10); - CSSNodeStyleSetBorder(root, CSSEdgeBottom, 10); + CSSNodeStyleSetBorder(root, YGEdgeLeft, 10); + CSSNodeStyleSetBorder(root, YGEdgeTop, 10); + CSSNodeStyleSetBorder(root, YGEdgeRight, 10); + CSSNodeStyleSetBorder(root, YGEdgeBottom, 10); const CSSNodeRef root_child0 = CSSNodeNew(); CSSNodeStyleSetWidth(root_child0, 10); CSSNodeStyleSetHeight(root_child0, 10); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -58,7 +58,7 @@ TEST(CSSLayoutTest, border_container_match_child) { ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -75,10 +75,10 @@ TEST(CSSLayoutTest, border_container_match_child) { TEST(CSSLayoutTest, border_flex_child) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetBorder(root, CSSEdgeLeft, 10); - CSSNodeStyleSetBorder(root, CSSEdgeTop, 10); - CSSNodeStyleSetBorder(root, CSSEdgeRight, 10); - CSSNodeStyleSetBorder(root, CSSEdgeBottom, 10); + CSSNodeStyleSetBorder(root, YGEdgeLeft, 10); + CSSNodeStyleSetBorder(root, YGEdgeTop, 10); + CSSNodeStyleSetBorder(root, YGEdgeRight, 10); + CSSNodeStyleSetBorder(root, YGEdgeBottom, 10); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -86,7 +86,7 @@ TEST(CSSLayoutTest, border_flex_child) { CSSNodeStyleSetFlexGrow(root_child0, 1); CSSNodeStyleSetWidth(root_child0, 10); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -98,7 +98,7 @@ TEST(CSSLayoutTest, border_flex_child) { ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(80, CSSNodeLayoutGetHeight(root_child0)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -115,17 +115,17 @@ TEST(CSSLayoutTest, border_flex_child) { TEST(CSSLayoutTest, border_stretch_child) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetBorder(root, CSSEdgeLeft, 10); - CSSNodeStyleSetBorder(root, CSSEdgeTop, 10); - CSSNodeStyleSetBorder(root, CSSEdgeRight, 10); - CSSNodeStyleSetBorder(root, CSSEdgeBottom, 10); + CSSNodeStyleSetBorder(root, YGEdgeLeft, 10); + CSSNodeStyleSetBorder(root, YGEdgeTop, 10); + CSSNodeStyleSetBorder(root, YGEdgeRight, 10); + CSSNodeStyleSetBorder(root, YGEdgeBottom, 10); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); const CSSNodeRef root_child0 = CSSNodeNew(); CSSNodeStyleSetHeight(root_child0, 10); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -137,7 +137,7 @@ TEST(CSSLayoutTest, border_stretch_child) { ASSERT_FLOAT_EQ(80, CSSNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -154,11 +154,11 @@ TEST(CSSLayoutTest, border_stretch_child) { TEST(CSSLayoutTest, border_center_child) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetJustifyContent(root, CSSJustifyCenter); - CSSNodeStyleSetAlignItems(root, CSSAlignCenter); - CSSNodeStyleSetBorder(root, CSSEdgeStart, 10); - CSSNodeStyleSetBorder(root, CSSEdgeEnd, 20); - CSSNodeStyleSetBorder(root, CSSEdgeBottom, 20); + CSSNodeStyleSetJustifyContent(root, YGJustifyCenter); + CSSNodeStyleSetAlignItems(root, YGAlignCenter); + CSSNodeStyleSetBorder(root, YGEdgeStart, 10); + CSSNodeStyleSetBorder(root, YGEdgeEnd, 20); + CSSNodeStyleSetBorder(root, YGEdgeBottom, 20); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -166,7 +166,7 @@ TEST(CSSLayoutTest, border_center_child) { CSSNodeStyleSetWidth(root_child0, 10); CSSNodeStyleSetHeight(root_child0, 10); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -178,7 +178,7 @@ TEST(CSSLayoutTest, border_center_child) { ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); diff --git a/tests/CSSLayoutDefaultValuesTest.cpp b/tests/CSSLayoutDefaultValuesTest.cpp index 727084c4..534607f2 100644 --- a/tests/CSSLayoutDefaultValuesTest.cpp +++ b/tests/CSSLayoutDefaultValuesTest.cpp @@ -16,46 +16,46 @@ TEST(CSSLayoutTest, assert_default_values) { ASSERT_EQ(0, CSSNodeChildCount(root)); ASSERT_EQ(NULL, CSSNodeGetChild(root, 1)); - ASSERT_EQ(CSSDirectionInherit, CSSNodeStyleGetDirection(root)); - ASSERT_EQ(CSSFlexDirectionColumn, CSSNodeStyleGetFlexDirection(root)); - ASSERT_EQ(CSSJustifyFlexStart, CSSNodeStyleGetJustifyContent(root)); - ASSERT_EQ(CSSAlignFlexStart, CSSNodeStyleGetAlignContent(root)); - ASSERT_EQ(CSSAlignStretch, CSSNodeStyleGetAlignItems(root)); - ASSERT_EQ(CSSAlignAuto, CSSNodeStyleGetAlignSelf(root)); - ASSERT_EQ(CSSPositionTypeRelative, CSSNodeStyleGetPositionType(root)); - ASSERT_EQ(CSSWrapNoWrap, CSSNodeStyleGetFlexWrap(root)); - ASSERT_EQ(CSSOverflowVisible, CSSNodeStyleGetOverflow(root)); + ASSERT_EQ(YGDirectionInherit, CSSNodeStyleGetDirection(root)); + ASSERT_EQ(YGFlexDirectionColumn, CSSNodeStyleGetFlexDirection(root)); + ASSERT_EQ(YGJustifyFlexStart, CSSNodeStyleGetJustifyContent(root)); + ASSERT_EQ(YGAlignFlexStart, CSSNodeStyleGetAlignContent(root)); + ASSERT_EQ(YGAlignStretch, CSSNodeStyleGetAlignItems(root)); + ASSERT_EQ(YGAlignAuto, CSSNodeStyleGetAlignSelf(root)); + ASSERT_EQ(YGPositionTypeRelative, CSSNodeStyleGetPositionType(root)); + ASSERT_EQ(YGWrapNoWrap, CSSNodeStyleGetFlexWrap(root)); + ASSERT_EQ(YGOverflowVisible, CSSNodeStyleGetOverflow(root)); ASSERT_FLOAT_EQ(0, CSSNodeStyleGetFlexGrow(root)); ASSERT_FLOAT_EQ(0, CSSNodeStyleGetFlexShrink(root)); ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetFlexBasis(root))); - ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPosition(root, CSSEdgeLeft))); - ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPosition(root, CSSEdgeTop))); - ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPosition(root, CSSEdgeRight))); - ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPosition(root, CSSEdgeBottom))); - ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPosition(root, CSSEdgeStart))); - ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPosition(root, CSSEdgeEnd))); + ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPosition(root, YGEdgeLeft))); + ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPosition(root, YGEdgeTop))); + ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPosition(root, YGEdgeRight))); + ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPosition(root, YGEdgeBottom))); + ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPosition(root, YGEdgeStart))); + ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPosition(root, YGEdgeEnd))); - ASSERT_FLOAT_EQ(0, CSSNodeStyleGetMargin(root, CSSEdgeLeft)); - ASSERT_FLOAT_EQ(0, CSSNodeStyleGetMargin(root, CSSEdgeTop)); - ASSERT_FLOAT_EQ(0, CSSNodeStyleGetMargin(root, CSSEdgeRight)); - ASSERT_FLOAT_EQ(0, CSSNodeStyleGetMargin(root, CSSEdgeBottom)); - ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetMargin(root, CSSEdgeStart))); - ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetMargin(root, CSSEdgeEnd))); + ASSERT_FLOAT_EQ(0, CSSNodeStyleGetMargin(root, YGEdgeLeft)); + ASSERT_FLOAT_EQ(0, CSSNodeStyleGetMargin(root, YGEdgeTop)); + ASSERT_FLOAT_EQ(0, CSSNodeStyleGetMargin(root, YGEdgeRight)); + ASSERT_FLOAT_EQ(0, CSSNodeStyleGetMargin(root, YGEdgeBottom)); + ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetMargin(root, YGEdgeStart))); + ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetMargin(root, YGEdgeEnd))); - ASSERT_FLOAT_EQ(0, CSSNodeStyleGetPadding(root, CSSEdgeLeft)); - ASSERT_FLOAT_EQ(0, CSSNodeStyleGetPadding(root, CSSEdgeTop)); - ASSERT_FLOAT_EQ(0, CSSNodeStyleGetPadding(root, CSSEdgeRight)); - ASSERT_FLOAT_EQ(0, CSSNodeStyleGetPadding(root, CSSEdgeBottom)); - ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPadding(root, CSSEdgeStart))); - ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPadding(root, CSSEdgeEnd))); + ASSERT_FLOAT_EQ(0, CSSNodeStyleGetPadding(root, YGEdgeLeft)); + ASSERT_FLOAT_EQ(0, CSSNodeStyleGetPadding(root, YGEdgeTop)); + ASSERT_FLOAT_EQ(0, CSSNodeStyleGetPadding(root, YGEdgeRight)); + ASSERT_FLOAT_EQ(0, CSSNodeStyleGetPadding(root, YGEdgeBottom)); + ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPadding(root, YGEdgeStart))); + ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPadding(root, YGEdgeEnd))); - ASSERT_FLOAT_EQ(0, CSSNodeStyleGetBorder(root, CSSEdgeLeft)); - ASSERT_FLOAT_EQ(0, CSSNodeStyleGetBorder(root, CSSEdgeTop)); - ASSERT_FLOAT_EQ(0, CSSNodeStyleGetBorder(root, CSSEdgeRight)); - ASSERT_FLOAT_EQ(0, CSSNodeStyleGetBorder(root, CSSEdgeBottom)); - ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetBorder(root, CSSEdgeStart))); - ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetBorder(root, CSSEdgeEnd))); + ASSERT_FLOAT_EQ(0, CSSNodeStyleGetBorder(root, YGEdgeLeft)); + ASSERT_FLOAT_EQ(0, CSSNodeStyleGetBorder(root, YGEdgeTop)); + ASSERT_FLOAT_EQ(0, CSSNodeStyleGetBorder(root, YGEdgeRight)); + ASSERT_FLOAT_EQ(0, CSSNodeStyleGetBorder(root, YGEdgeBottom)); + ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetBorder(root, YGEdgeStart))); + ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetBorder(root, YGEdgeEnd))); ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetWidth(root))); ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetHeight(root))); @@ -70,7 +70,7 @@ TEST(CSSLayoutTest, assert_default_values) { ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetBottom(root)); ASSERT_TRUE(CSSValueIsUndefined(CSSNodeLayoutGetWidth(root))); ASSERT_TRUE(CSSValueIsUndefined(CSSNodeLayoutGetHeight(root))); - ASSERT_EQ(CSSDirectionInherit, CSSNodeLayoutGetDirection(root)); + ASSERT_EQ(YGDirectionInherit, CSSNodeLayoutGetDirection(root)); CSSNodeFreeRecursive(root); } diff --git a/tests/CSSLayoutDirtyMarkingTest.cpp b/tests/CSSLayoutDirtyMarkingTest.cpp index fed544f3..5177bfab 100644 --- a/tests/CSSLayoutDirtyMarkingTest.cpp +++ b/tests/CSSLayoutDirtyMarkingTest.cpp @@ -12,7 +12,7 @@ TEST(CSSLayoutTest, dirty_propagation) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); + CSSNodeStyleSetAlignItems(root, YGAlignFlexStart); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -26,7 +26,7 @@ TEST(CSSLayoutTest, dirty_propagation) { CSSNodeStyleSetHeight(root_child1, 20); CSSNodeInsertChild(root, root_child1, 1); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); CSSNodeStyleSetWidth(root_child0, 20); @@ -34,7 +34,7 @@ TEST(CSSLayoutTest, dirty_propagation) { EXPECT_FALSE(CSSNodeIsDirty(root_child1)); EXPECT_TRUE(CSSNodeIsDirty(root)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); EXPECT_FALSE(CSSNodeIsDirty(root_child0)); EXPECT_FALSE(CSSNodeIsDirty(root_child1)); @@ -45,7 +45,7 @@ TEST(CSSLayoutTest, dirty_propagation) { TEST(CSSLayoutTest, dirty_propagation_only_if_prop_changed) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); + CSSNodeStyleSetAlignItems(root, YGAlignFlexStart); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -59,7 +59,7 @@ TEST(CSSLayoutTest, dirty_propagation_only_if_prop_changed) { CSSNodeStyleSetHeight(root_child1, 20); CSSNodeInsertChild(root, root_child1, 1); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); CSSNodeStyleSetWidth(root_child0, 50); @@ -72,7 +72,7 @@ TEST(CSSLayoutTest, dirty_propagation_only_if_prop_changed) { TEST(CSSLayoutTest, dirty_node_only_if_children_are_actually_removed) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); + CSSNodeStyleSetAlignItems(root, YGAlignFlexStart); CSSNodeStyleSetWidth(root, 50); CSSNodeStyleSetHeight(root, 50); @@ -81,7 +81,7 @@ TEST(CSSLayoutTest, dirty_node_only_if_children_are_actually_removed) { CSSNodeStyleSetHeight(child0, 25); CSSNodeInsertChild(root, child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); const CSSNodeRef child1 = CSSNodeNew(); CSSNodeRemoveChild(root, child1); diff --git a/tests/CSSLayoutEdgeTest.cpp b/tests/CSSLayoutEdgeTest.cpp index ea171b59..00d952fa 100644 --- a/tests/CSSLayoutEdgeTest.cpp +++ b/tests/CSSLayoutEdgeTest.cpp @@ -12,22 +12,22 @@ TEST(CSSLayoutTest, start_overrides) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); + CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); const CSSNodeRef root_child0 = CSSNodeNew(); CSSNodeStyleSetFlexGrow(root_child0, 1); - CSSNodeStyleSetMargin(root_child0, CSSEdgeStart, 10); - CSSNodeStyleSetMargin(root_child0, CSSEdgeLeft, 20); - CSSNodeStyleSetMargin(root_child0, CSSEdgeRight, 20); + CSSNodeStyleSetMargin(root_child0, YGEdgeStart, 10); + CSSNodeStyleSetMargin(root_child0, YGEdgeLeft, 20); + CSSNodeStyleSetMargin(root_child0, YGEdgeRight, 20); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetLeft(root_child0)); ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetRight(root_child0)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetLeft(root_child0)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetRight(root_child0)); @@ -36,22 +36,22 @@ TEST(CSSLayoutTest, start_overrides) { TEST(CSSLayoutTest, end_overrides) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); + CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); const CSSNodeRef root_child0 = CSSNodeNew(); CSSNodeStyleSetFlexGrow(root_child0, 1); - CSSNodeStyleSetMargin(root_child0, CSSEdgeEnd, 10); - CSSNodeStyleSetMargin(root_child0, CSSEdgeLeft, 20); - CSSNodeStyleSetMargin(root_child0, CSSEdgeRight, 20); + CSSNodeStyleSetMargin(root_child0, YGEdgeEnd, 10); + CSSNodeStyleSetMargin(root_child0, YGEdgeLeft, 20); + CSSNodeStyleSetMargin(root_child0, YGEdgeRight, 20); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetLeft(root_child0)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetRight(root_child0)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetLeft(root_child0)); ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetRight(root_child0)); @@ -60,17 +60,17 @@ TEST(CSSLayoutTest, end_overrides) { TEST(CSSLayoutTest, horizontal_overridden) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); + CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); const CSSNodeRef root_child0 = CSSNodeNew(); CSSNodeStyleSetFlexGrow(root_child0, 1); - CSSNodeStyleSetMargin(root_child0, CSSEdgeHorizontal, 10); - CSSNodeStyleSetMargin(root_child0, CSSEdgeLeft, 20); + CSSNodeStyleSetMargin(root_child0, YGEdgeHorizontal, 10); + CSSNodeStyleSetMargin(root_child0, YGEdgeLeft, 20); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetLeft(root_child0)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetRight(root_child0)); @@ -79,17 +79,17 @@ TEST(CSSLayoutTest, horizontal_overridden) { TEST(CSSLayoutTest, vertical_overridden) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionColumn); + CSSNodeStyleSetFlexDirection(root, YGFlexDirectionColumn); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); const CSSNodeRef root_child0 = CSSNodeNew(); CSSNodeStyleSetFlexGrow(root_child0, 1); - CSSNodeStyleSetMargin(root_child0, CSSEdgeVertical, 10); - CSSNodeStyleSetMargin(root_child0, CSSEdgeTop, 20); + CSSNodeStyleSetMargin(root_child0, YGEdgeVertical, 10); + CSSNodeStyleSetMargin(root_child0, YGEdgeTop, 20); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetTop(root_child0)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetBottom(root_child0)); @@ -98,17 +98,17 @@ TEST(CSSLayoutTest, vertical_overridden) { TEST(CSSLayoutTest, horizontal_overrides_all) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionColumn); + CSSNodeStyleSetFlexDirection(root, YGFlexDirectionColumn); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); const CSSNodeRef root_child0 = CSSNodeNew(); CSSNodeStyleSetFlexGrow(root_child0, 1); - CSSNodeStyleSetMargin(root_child0, CSSEdgeHorizontal, 10); - CSSNodeStyleSetMargin(root_child0, CSSEdgeAll, 20); + CSSNodeStyleSetMargin(root_child0, YGEdgeHorizontal, 10); + CSSNodeStyleSetMargin(root_child0, YGEdgeAll, 20); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetLeft(root_child0)); ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetTop(root_child0)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetRight(root_child0)); @@ -119,17 +119,17 @@ TEST(CSSLayoutTest, horizontal_overrides_all) { TEST(CSSLayoutTest, vertical_overrides_all) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionColumn); + CSSNodeStyleSetFlexDirection(root, YGFlexDirectionColumn); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); const CSSNodeRef root_child0 = CSSNodeNew(); CSSNodeStyleSetFlexGrow(root_child0, 1); - CSSNodeStyleSetMargin(root_child0, CSSEdgeVertical, 10); - CSSNodeStyleSetMargin(root_child0, CSSEdgeAll, 20); + CSSNodeStyleSetMargin(root_child0, YGEdgeVertical, 10); + CSSNodeStyleSetMargin(root_child0, YGEdgeAll, 20); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetLeft(root_child0)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetTop(root_child0)); ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetRight(root_child0)); @@ -140,20 +140,20 @@ TEST(CSSLayoutTest, vertical_overrides_all) { TEST(CSSLayoutTest, all_overridden) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionColumn); + CSSNodeStyleSetFlexDirection(root, YGFlexDirectionColumn); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); const CSSNodeRef root_child0 = CSSNodeNew(); CSSNodeStyleSetFlexGrow(root_child0, 1); - CSSNodeStyleSetMargin(root_child0, CSSEdgeLeft, 10); - CSSNodeStyleSetMargin(root_child0, CSSEdgeTop, 10); - CSSNodeStyleSetMargin(root_child0, CSSEdgeRight, 10); - CSSNodeStyleSetMargin(root_child0, CSSEdgeBottom, 10); - CSSNodeStyleSetMargin(root_child0, CSSEdgeAll, 20); + CSSNodeStyleSetMargin(root_child0, YGEdgeLeft, 10); + CSSNodeStyleSetMargin(root_child0, YGEdgeTop, 10); + CSSNodeStyleSetMargin(root_child0, YGEdgeRight, 10); + CSSNodeStyleSetMargin(root_child0, YGEdgeBottom, 10); + CSSNodeStyleSetMargin(root_child0, YGEdgeAll, 20); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetLeft(root_child0)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetTop(root_child0)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetRight(root_child0)); diff --git a/tests/CSSLayoutFlexDirectionTest.cpp b/tests/CSSLayoutFlexDirectionTest.cpp index 9b319d0d..48ac2724 100644 --- a/tests/CSSLayoutFlexDirectionTest.cpp +++ b/tests/CSSLayoutFlexDirectionTest.cpp @@ -27,7 +27,7 @@ TEST(CSSLayoutTest, flex_direction_column_no_height) { const CSSNodeRef root_child2 = CSSNodeNew(); CSSNodeStyleSetHeight(root_child2, 10); CSSNodeInsertChild(root, root_child2, 2); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -49,7 +49,7 @@ TEST(CSSLayoutTest, flex_direction_column_no_height) { ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child2)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child2)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -76,7 +76,7 @@ TEST(CSSLayoutTest, flex_direction_column_no_height) { TEST(CSSLayoutTest, flex_direction_row_no_width) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); + CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow); CSSNodeStyleSetHeight(root, 100); const CSSNodeRef root_child0 = CSSNodeNew(); @@ -90,7 +90,7 @@ TEST(CSSLayoutTest, flex_direction_row_no_width) { const CSSNodeRef root_child2 = CSSNodeNew(); CSSNodeStyleSetWidth(root_child2, 10); CSSNodeInsertChild(root, root_child2, 2); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -112,7 +112,7 @@ TEST(CSSLayoutTest, flex_direction_row_no_width) { ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child2)); ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child2)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -153,7 +153,7 @@ TEST(CSSLayoutTest, flex_direction_column) { const CSSNodeRef root_child2 = CSSNodeNew(); CSSNodeStyleSetHeight(root_child2, 10); CSSNodeInsertChild(root, root_child2, 2); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -175,7 +175,7 @@ TEST(CSSLayoutTest, flex_direction_column) { ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child2)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child2)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -202,7 +202,7 @@ TEST(CSSLayoutTest, flex_direction_column) { TEST(CSSLayoutTest, flex_direction_row) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); + CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -217,7 +217,7 @@ TEST(CSSLayoutTest, flex_direction_row) { const CSSNodeRef root_child2 = CSSNodeNew(); CSSNodeStyleSetWidth(root_child2, 10); CSSNodeInsertChild(root, root_child2, 2); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -239,7 +239,7 @@ TEST(CSSLayoutTest, flex_direction_row) { ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child2)); ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child2)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -266,7 +266,7 @@ TEST(CSSLayoutTest, flex_direction_row) { TEST(CSSLayoutTest, flex_direction_column_reverse) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionColumnReverse); + CSSNodeStyleSetFlexDirection(root, YGFlexDirectionColumnReverse); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -281,7 +281,7 @@ TEST(CSSLayoutTest, flex_direction_column_reverse) { const CSSNodeRef root_child2 = CSSNodeNew(); CSSNodeStyleSetHeight(root_child2, 10); CSSNodeInsertChild(root, root_child2, 2); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -303,7 +303,7 @@ TEST(CSSLayoutTest, flex_direction_column_reverse) { ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child2)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child2)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -330,7 +330,7 @@ TEST(CSSLayoutTest, flex_direction_column_reverse) { TEST(CSSLayoutTest, flex_direction_row_reverse) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRowReverse); + CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRowReverse); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -345,7 +345,7 @@ TEST(CSSLayoutTest, flex_direction_row_reverse) { const CSSNodeRef root_child2 = CSSNodeNew(); CSSNodeStyleSetWidth(root_child2, 10); CSSNodeInsertChild(root, root_child2, 2); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -367,7 +367,7 @@ TEST(CSSLayoutTest, flex_direction_row_reverse) { ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child2)); ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child2)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); diff --git a/tests/CSSLayoutFlexTest.cpp b/tests/CSSLayoutFlexTest.cpp index 3ccef380..b31af0f6 100644 --- a/tests/CSSLayoutFlexTest.cpp +++ b/tests/CSSLayoutFlexTest.cpp @@ -25,7 +25,7 @@ TEST(CSSLayoutTest, flex_basis_flex_grow_column) { const CSSNodeRef root_child1 = CSSNodeNew(); CSSNodeStyleSetFlexGrow(root_child1, 1); CSSNodeInsertChild(root, root_child1, 1); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -42,7 +42,7 @@ TEST(CSSLayoutTest, flex_basis_flex_grow_column) { ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child1)); ASSERT_FLOAT_EQ(25, CSSNodeLayoutGetHeight(root_child1)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -64,7 +64,7 @@ TEST(CSSLayoutTest, flex_basis_flex_grow_column) { TEST(CSSLayoutTest, flex_basis_flex_grow_row) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); + CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -76,7 +76,7 @@ TEST(CSSLayoutTest, flex_basis_flex_grow_row) { const CSSNodeRef root_child1 = CSSNodeNew(); CSSNodeStyleSetFlexGrow(root_child1, 1); CSSNodeInsertChild(root, root_child1, 1); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -93,7 +93,7 @@ TEST(CSSLayoutTest, flex_basis_flex_grow_row) { ASSERT_FLOAT_EQ(25, CSSNodeLayoutGetWidth(root_child1)); ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child1)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -126,7 +126,7 @@ TEST(CSSLayoutTest, flex_basis_flex_shrink_column) { const CSSNodeRef root_child1 = CSSNodeNew(); CSSNodeStyleSetFlexBasis(root_child1, 50); CSSNodeInsertChild(root, root_child1, 1); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -143,7 +143,7 @@ TEST(CSSLayoutTest, flex_basis_flex_shrink_column) { ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child1)); ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetHeight(root_child1)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -165,7 +165,7 @@ TEST(CSSLayoutTest, flex_basis_flex_shrink_column) { TEST(CSSLayoutTest, flex_basis_flex_shrink_row) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); + CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -177,7 +177,7 @@ TEST(CSSLayoutTest, flex_basis_flex_shrink_row) { const CSSNodeRef root_child1 = CSSNodeNew(); CSSNodeStyleSetFlexBasis(root_child1, 50); CSSNodeInsertChild(root, root_child1, 1); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -194,7 +194,7 @@ TEST(CSSLayoutTest, flex_basis_flex_shrink_row) { ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetWidth(root_child1)); ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child1)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -233,7 +233,7 @@ TEST(CSSLayoutTest, flex_shrink_to_zero) { CSSNodeStyleSetWidth(root_child2, 50); CSSNodeStyleSetHeight(root_child2, 50); CSSNodeInsertChild(root, root_child2, 2); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -255,7 +255,7 @@ TEST(CSSLayoutTest, flex_shrink_to_zero) { ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetWidth(root_child2)); ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetHeight(root_child2)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -300,7 +300,7 @@ TEST(CSSLayoutTest, flex_basis_overrides_main_size) { CSSNodeStyleSetFlexGrow(root_child2, 1); CSSNodeStyleSetHeight(root_child2, 10); CSSNodeInsertChild(root, root_child2, 2); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -322,7 +322,7 @@ TEST(CSSLayoutTest, flex_basis_overrides_main_size) { ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child2)); ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetHeight(root_child2)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -359,7 +359,7 @@ TEST(CSSLayoutTest, flex_grow_shrink_at_most) { CSSNodeStyleSetFlexGrow(root_child0_child0, 1); CSSNodeStyleSetFlexShrink(root_child0_child0, 1); CSSNodeInsertChild(root_child0, root_child0_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -376,7 +376,7 @@ TEST(CSSLayoutTest, flex_grow_shrink_at_most) { ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child0_child0)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetHeight(root_child0_child0)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); diff --git a/tests/CSSLayoutFlexWrapTest.cpp b/tests/CSSLayoutFlexWrapTest.cpp index ae5113c4..d4be92b5 100644 --- a/tests/CSSLayoutFlexWrapTest.cpp +++ b/tests/CSSLayoutFlexWrapTest.cpp @@ -14,7 +14,7 @@ TEST(CSSLayoutTest, wrap_column) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetFlexWrap(root, CSSWrapWrap); + CSSNodeStyleSetFlexWrap(root, YGWrapWrap); CSSNodeStyleSetHeight(root, 100); const CSSNodeRef root_child0 = CSSNodeNew(); @@ -36,7 +36,7 @@ TEST(CSSLayoutTest, wrap_column) { CSSNodeStyleSetWidth(root_child3, 30); CSSNodeStyleSetHeight(root_child3, 30); CSSNodeInsertChild(root, root_child3, 3); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -63,7 +63,7 @@ TEST(CSSLayoutTest, wrap_column) { ASSERT_FLOAT_EQ(30, CSSNodeLayoutGetWidth(root_child3)); ASSERT_FLOAT_EQ(30, CSSNodeLayoutGetHeight(root_child3)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -95,8 +95,8 @@ TEST(CSSLayoutTest, wrap_column) { TEST(CSSLayoutTest, wrap_row) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); - CSSNodeStyleSetFlexWrap(root, CSSWrapWrap); + CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow); + CSSNodeStyleSetFlexWrap(root, YGWrapWrap); CSSNodeStyleSetWidth(root, 100); const CSSNodeRef root_child0 = CSSNodeNew(); @@ -118,7 +118,7 @@ TEST(CSSLayoutTest, wrap_row) { CSSNodeStyleSetWidth(root_child3, 30); CSSNodeStyleSetHeight(root_child3, 30); CSSNodeInsertChild(root, root_child3, 3); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -145,7 +145,7 @@ TEST(CSSLayoutTest, wrap_row) { ASSERT_FLOAT_EQ(30, CSSNodeLayoutGetWidth(root_child3)); ASSERT_FLOAT_EQ(30, CSSNodeLayoutGetHeight(root_child3)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -177,9 +177,9 @@ TEST(CSSLayoutTest, wrap_row) { TEST(CSSLayoutTest, wrap_row_align_items_flex_end) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); - CSSNodeStyleSetAlignItems(root, CSSAlignFlexEnd); - CSSNodeStyleSetFlexWrap(root, CSSWrapWrap); + CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow); + CSSNodeStyleSetAlignItems(root, YGAlignFlexEnd); + CSSNodeStyleSetFlexWrap(root, YGWrapWrap); CSSNodeStyleSetWidth(root, 100); const CSSNodeRef root_child0 = CSSNodeNew(); @@ -201,7 +201,7 @@ TEST(CSSLayoutTest, wrap_row_align_items_flex_end) { CSSNodeStyleSetWidth(root_child3, 30); CSSNodeStyleSetHeight(root_child3, 30); CSSNodeInsertChild(root, root_child3, 3); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -228,7 +228,7 @@ TEST(CSSLayoutTest, wrap_row_align_items_flex_end) { ASSERT_FLOAT_EQ(30, CSSNodeLayoutGetWidth(root_child3)); ASSERT_FLOAT_EQ(30, CSSNodeLayoutGetHeight(root_child3)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -260,9 +260,9 @@ TEST(CSSLayoutTest, wrap_row_align_items_flex_end) { TEST(CSSLayoutTest, wrap_row_align_items_center) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); - CSSNodeStyleSetAlignItems(root, CSSAlignCenter); - CSSNodeStyleSetFlexWrap(root, CSSWrapWrap); + CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow); + CSSNodeStyleSetAlignItems(root, YGAlignCenter); + CSSNodeStyleSetFlexWrap(root, YGWrapWrap); CSSNodeStyleSetWidth(root, 100); const CSSNodeRef root_child0 = CSSNodeNew(); @@ -284,7 +284,7 @@ TEST(CSSLayoutTest, wrap_row_align_items_center) { CSSNodeStyleSetWidth(root_child3, 30); CSSNodeStyleSetHeight(root_child3, 30); CSSNodeInsertChild(root, root_child3, 3); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -311,7 +311,7 @@ TEST(CSSLayoutTest, wrap_row_align_items_center) { ASSERT_FLOAT_EQ(30, CSSNodeLayoutGetWidth(root_child3)); ASSERT_FLOAT_EQ(30, CSSNodeLayoutGetHeight(root_child3)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); diff --git a/tests/CSSLayoutJustifyContentTest.cpp b/tests/CSSLayoutJustifyContentTest.cpp index 6ac22334..9903c437 100644 --- a/tests/CSSLayoutJustifyContentTest.cpp +++ b/tests/CSSLayoutJustifyContentTest.cpp @@ -14,7 +14,7 @@ TEST(CSSLayoutTest, justify_content_row_flex_start) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); + CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow); CSSNodeStyleSetWidth(root, 102); CSSNodeStyleSetHeight(root, 102); @@ -29,7 +29,7 @@ TEST(CSSLayoutTest, justify_content_row_flex_start) { const CSSNodeRef root_child2 = CSSNodeNew(); CSSNodeStyleSetWidth(root_child2, 10); CSSNodeInsertChild(root, root_child2, 2); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -51,7 +51,7 @@ TEST(CSSLayoutTest, justify_content_row_flex_start) { ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child2)); ASSERT_FLOAT_EQ(102, CSSNodeLayoutGetHeight(root_child2)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -78,8 +78,8 @@ TEST(CSSLayoutTest, justify_content_row_flex_start) { TEST(CSSLayoutTest, justify_content_row_flex_end) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); - CSSNodeStyleSetJustifyContent(root, CSSJustifyFlexEnd); + CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow); + CSSNodeStyleSetJustifyContent(root, YGJustifyFlexEnd); CSSNodeStyleSetWidth(root, 102); CSSNodeStyleSetHeight(root, 102); @@ -94,7 +94,7 @@ TEST(CSSLayoutTest, justify_content_row_flex_end) { const CSSNodeRef root_child2 = CSSNodeNew(); CSSNodeStyleSetWidth(root_child2, 10); CSSNodeInsertChild(root, root_child2, 2); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -116,7 +116,7 @@ TEST(CSSLayoutTest, justify_content_row_flex_end) { ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child2)); ASSERT_FLOAT_EQ(102, CSSNodeLayoutGetHeight(root_child2)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -143,8 +143,8 @@ TEST(CSSLayoutTest, justify_content_row_flex_end) { TEST(CSSLayoutTest, justify_content_row_center) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); - CSSNodeStyleSetJustifyContent(root, CSSJustifyCenter); + CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow); + CSSNodeStyleSetJustifyContent(root, YGJustifyCenter); CSSNodeStyleSetWidth(root, 102); CSSNodeStyleSetHeight(root, 102); @@ -159,7 +159,7 @@ TEST(CSSLayoutTest, justify_content_row_center) { const CSSNodeRef root_child2 = CSSNodeNew(); CSSNodeStyleSetWidth(root_child2, 10); CSSNodeInsertChild(root, root_child2, 2); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -181,7 +181,7 @@ TEST(CSSLayoutTest, justify_content_row_center) { ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child2)); ASSERT_FLOAT_EQ(102, CSSNodeLayoutGetHeight(root_child2)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -208,8 +208,8 @@ TEST(CSSLayoutTest, justify_content_row_center) { TEST(CSSLayoutTest, justify_content_row_space_between) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); - CSSNodeStyleSetJustifyContent(root, CSSJustifySpaceBetween); + CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow); + CSSNodeStyleSetJustifyContent(root, YGJustifySpaceBetween); CSSNodeStyleSetWidth(root, 102); CSSNodeStyleSetHeight(root, 102); @@ -224,7 +224,7 @@ TEST(CSSLayoutTest, justify_content_row_space_between) { const CSSNodeRef root_child2 = CSSNodeNew(); CSSNodeStyleSetWidth(root_child2, 10); CSSNodeInsertChild(root, root_child2, 2); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -246,7 +246,7 @@ TEST(CSSLayoutTest, justify_content_row_space_between) { ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child2)); ASSERT_FLOAT_EQ(102, CSSNodeLayoutGetHeight(root_child2)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -273,8 +273,8 @@ TEST(CSSLayoutTest, justify_content_row_space_between) { TEST(CSSLayoutTest, justify_content_row_space_around) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); - CSSNodeStyleSetJustifyContent(root, CSSJustifySpaceAround); + CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow); + CSSNodeStyleSetJustifyContent(root, YGJustifySpaceAround); CSSNodeStyleSetWidth(root, 102); CSSNodeStyleSetHeight(root, 102); @@ -289,7 +289,7 @@ TEST(CSSLayoutTest, justify_content_row_space_around) { const CSSNodeRef root_child2 = CSSNodeNew(); CSSNodeStyleSetWidth(root_child2, 10); CSSNodeInsertChild(root, root_child2, 2); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -311,7 +311,7 @@ TEST(CSSLayoutTest, justify_content_row_space_around) { ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child2)); ASSERT_FLOAT_EQ(102, CSSNodeLayoutGetHeight(root_child2)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -351,7 +351,7 @@ TEST(CSSLayoutTest, justify_content_column_flex_start) { const CSSNodeRef root_child2 = CSSNodeNew(); CSSNodeStyleSetHeight(root_child2, 10); CSSNodeInsertChild(root, root_child2, 2); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -373,7 +373,7 @@ TEST(CSSLayoutTest, justify_content_column_flex_start) { ASSERT_FLOAT_EQ(102, CSSNodeLayoutGetWidth(root_child2)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child2)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -400,7 +400,7 @@ TEST(CSSLayoutTest, justify_content_column_flex_start) { TEST(CSSLayoutTest, justify_content_column_flex_end) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetJustifyContent(root, CSSJustifyFlexEnd); + CSSNodeStyleSetJustifyContent(root, YGJustifyFlexEnd); CSSNodeStyleSetWidth(root, 102); CSSNodeStyleSetHeight(root, 102); @@ -415,7 +415,7 @@ TEST(CSSLayoutTest, justify_content_column_flex_end) { const CSSNodeRef root_child2 = CSSNodeNew(); CSSNodeStyleSetHeight(root_child2, 10); CSSNodeInsertChild(root, root_child2, 2); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -437,7 +437,7 @@ TEST(CSSLayoutTest, justify_content_column_flex_end) { ASSERT_FLOAT_EQ(102, CSSNodeLayoutGetWidth(root_child2)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child2)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -464,7 +464,7 @@ TEST(CSSLayoutTest, justify_content_column_flex_end) { TEST(CSSLayoutTest, justify_content_column_center) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetJustifyContent(root, CSSJustifyCenter); + CSSNodeStyleSetJustifyContent(root, YGJustifyCenter); CSSNodeStyleSetWidth(root, 102); CSSNodeStyleSetHeight(root, 102); @@ -479,7 +479,7 @@ TEST(CSSLayoutTest, justify_content_column_center) { const CSSNodeRef root_child2 = CSSNodeNew(); CSSNodeStyleSetHeight(root_child2, 10); CSSNodeInsertChild(root, root_child2, 2); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -501,7 +501,7 @@ TEST(CSSLayoutTest, justify_content_column_center) { ASSERT_FLOAT_EQ(102, CSSNodeLayoutGetWidth(root_child2)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child2)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -528,7 +528,7 @@ TEST(CSSLayoutTest, justify_content_column_center) { TEST(CSSLayoutTest, justify_content_column_space_between) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetJustifyContent(root, CSSJustifySpaceBetween); + CSSNodeStyleSetJustifyContent(root, YGJustifySpaceBetween); CSSNodeStyleSetWidth(root, 102); CSSNodeStyleSetHeight(root, 102); @@ -543,7 +543,7 @@ TEST(CSSLayoutTest, justify_content_column_space_between) { const CSSNodeRef root_child2 = CSSNodeNew(); CSSNodeStyleSetHeight(root_child2, 10); CSSNodeInsertChild(root, root_child2, 2); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -565,7 +565,7 @@ TEST(CSSLayoutTest, justify_content_column_space_between) { ASSERT_FLOAT_EQ(102, CSSNodeLayoutGetWidth(root_child2)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child2)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -592,7 +592,7 @@ TEST(CSSLayoutTest, justify_content_column_space_between) { TEST(CSSLayoutTest, justify_content_column_space_around) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetJustifyContent(root, CSSJustifySpaceAround); + CSSNodeStyleSetJustifyContent(root, YGJustifySpaceAround); CSSNodeStyleSetWidth(root, 102); CSSNodeStyleSetHeight(root, 102); @@ -607,7 +607,7 @@ TEST(CSSLayoutTest, justify_content_column_space_around) { const CSSNodeRef root_child2 = CSSNodeNew(); CSSNodeStyleSetHeight(root_child2, 10); CSSNodeInsertChild(root, root_child2, 2); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -629,7 +629,7 @@ TEST(CSSLayoutTest, justify_content_column_space_around) { ASSERT_FLOAT_EQ(102, CSSNodeLayoutGetWidth(root_child2)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child2)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); diff --git a/tests/CSSLayoutMarginTest.cpp b/tests/CSSLayoutMarginTest.cpp index 091ef4d0..a10aa362 100644 --- a/tests/CSSLayoutMarginTest.cpp +++ b/tests/CSSLayoutMarginTest.cpp @@ -14,15 +14,15 @@ TEST(CSSLayoutTest, margin_start) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); + CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); const CSSNodeRef root_child0 = CSSNodeNew(); - CSSNodeStyleSetMargin(root_child0, CSSEdgeStart, 10); + CSSNodeStyleSetMargin(root_child0, YGEdgeStart, 10); CSSNodeStyleSetWidth(root_child0, 10); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -34,7 +34,7 @@ TEST(CSSLayoutTest, margin_start) { ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child0)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -55,10 +55,10 @@ TEST(CSSLayoutTest, margin_top) { CSSNodeStyleSetHeight(root, 100); const CSSNodeRef root_child0 = CSSNodeNew(); - CSSNodeStyleSetMargin(root_child0, CSSEdgeTop, 10); + CSSNodeStyleSetMargin(root_child0, YGEdgeTop, 10); CSSNodeStyleSetHeight(root_child0, 10); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -70,7 +70,7 @@ TEST(CSSLayoutTest, margin_top) { ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -87,16 +87,16 @@ TEST(CSSLayoutTest, margin_top) { TEST(CSSLayoutTest, margin_end) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); - CSSNodeStyleSetJustifyContent(root, CSSJustifyFlexEnd); + CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow); + CSSNodeStyleSetJustifyContent(root, YGJustifyFlexEnd); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); const CSSNodeRef root_child0 = CSSNodeNew(); - CSSNodeStyleSetMargin(root_child0, CSSEdgeEnd, 10); + CSSNodeStyleSetMargin(root_child0, YGEdgeEnd, 10); CSSNodeStyleSetWidth(root_child0, 10); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -108,7 +108,7 @@ TEST(CSSLayoutTest, margin_end) { ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child0)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -125,15 +125,15 @@ TEST(CSSLayoutTest, margin_end) { TEST(CSSLayoutTest, margin_bottom) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetJustifyContent(root, CSSJustifyFlexEnd); + CSSNodeStyleSetJustifyContent(root, YGJustifyFlexEnd); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); const CSSNodeRef root_child0 = CSSNodeNew(); - CSSNodeStyleSetMargin(root_child0, CSSEdgeBottom, 10); + CSSNodeStyleSetMargin(root_child0, YGEdgeBottom, 10); CSSNodeStyleSetHeight(root_child0, 10); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -145,7 +145,7 @@ TEST(CSSLayoutTest, margin_bottom) { ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -162,15 +162,15 @@ TEST(CSSLayoutTest, margin_bottom) { TEST(CSSLayoutTest, margin_and_flex_row) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); + CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); const CSSNodeRef root_child0 = CSSNodeNew(); CSSNodeStyleSetFlexGrow(root_child0, 1); - CSSNodeStyleSetMargin(root_child0, CSSEdgeStart, 10); + CSSNodeStyleSetMargin(root_child0, YGEdgeStart, 10); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -182,7 +182,7 @@ TEST(CSSLayoutTest, margin_and_flex_row) { ASSERT_FLOAT_EQ(90, CSSNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child0)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -204,9 +204,9 @@ TEST(CSSLayoutTest, margin_and_flex_column) { const CSSNodeRef root_child0 = CSSNodeNew(); CSSNodeStyleSetFlexGrow(root_child0, 1); - CSSNodeStyleSetMargin(root_child0, CSSEdgeTop, 10); + CSSNodeStyleSetMargin(root_child0, YGEdgeTop, 10); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -218,7 +218,7 @@ TEST(CSSLayoutTest, margin_and_flex_column) { ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(90, CSSNodeLayoutGetHeight(root_child0)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -235,15 +235,15 @@ TEST(CSSLayoutTest, margin_and_flex_column) { TEST(CSSLayoutTest, margin_and_stretch_row) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); + CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); const CSSNodeRef root_child0 = CSSNodeNew(); CSSNodeStyleSetFlexGrow(root_child0, 1); - CSSNodeStyleSetMargin(root_child0, CSSEdgeTop, 10); + CSSNodeStyleSetMargin(root_child0, YGEdgeTop, 10); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -255,7 +255,7 @@ TEST(CSSLayoutTest, margin_and_stretch_row) { ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(90, CSSNodeLayoutGetHeight(root_child0)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -277,9 +277,9 @@ TEST(CSSLayoutTest, margin_and_stretch_column) { const CSSNodeRef root_child0 = CSSNodeNew(); CSSNodeStyleSetFlexGrow(root_child0, 1); - CSSNodeStyleSetMargin(root_child0, CSSEdgeStart, 10); + CSSNodeStyleSetMargin(root_child0, YGEdgeStart, 10); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -291,7 +291,7 @@ TEST(CSSLayoutTest, margin_and_stretch_column) { ASSERT_FLOAT_EQ(90, CSSNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child0)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -308,7 +308,7 @@ TEST(CSSLayoutTest, margin_and_stretch_column) { TEST(CSSLayoutTest, margin_with_sibling_row) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); + CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -319,7 +319,7 @@ TEST(CSSLayoutTest, margin_with_sibling_row) { const CSSNodeRef root_child1 = CSSNodeNew(); CSSNodeStyleSetFlexGrow(root_child1, 1); CSSNodeInsertChild(root, root_child1, 1); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -336,7 +336,7 @@ TEST(CSSLayoutTest, margin_with_sibling_row) { ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetWidth(root_child1)); ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child1)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -368,7 +368,7 @@ TEST(CSSLayoutTest, margin_with_sibling_column) { const CSSNodeRef root_child1 = CSSNodeNew(); CSSNodeStyleSetFlexGrow(root_child1, 1); CSSNodeInsertChild(root, root_child1, 1); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -385,7 +385,7 @@ TEST(CSSLayoutTest, margin_with_sibling_column) { ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child1)); ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetHeight(root_child1)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); diff --git a/tests/CSSLayoutMeasureCacheTest.cpp b/tests/CSSLayoutMeasureCacheTest.cpp index 9378b579..9a9674a0 100644 --- a/tests/CSSLayoutMeasureCacheTest.cpp +++ b/tests/CSSLayoutMeasureCacheTest.cpp @@ -12,37 +12,37 @@ static CSSSize _measureMax(CSSNodeRef node, float width, - CSSMeasureMode widthMode, + YGMeasureMode widthMode, float height, - CSSMeasureMode heightMode) { + YGMeasureMode heightMode) { int *measureCount = (int *)CSSNodeGetContext(node); (*measureCount)++; return CSSSize { - .width = widthMode == CSSMeasureModeUndefined ? 10 : width, - .height = heightMode == CSSMeasureModeUndefined ? 10 : height, + .width = widthMode == YGMeasureModeUndefined ? 10 : width, + .height = heightMode == YGMeasureModeUndefined ? 10 : height, }; } static CSSSize _measureMin(CSSNodeRef node, float width, - CSSMeasureMode widthMode, + YGMeasureMode widthMode, float height, - CSSMeasureMode heightMode) { + YGMeasureMode heightMode) { int *measureCount = (int *)CSSNodeGetContext(node); *measureCount = *measureCount + 1; return CSSSize { - .width = widthMode == CSSMeasureModeUndefined || (widthMode == CSSMeasureModeAtMost && width > 10) ? 10 : width, - .height = heightMode == CSSMeasureModeUndefined || (heightMode == CSSMeasureModeAtMost && height > 10) ? 10 : height, + .width = widthMode == YGMeasureModeUndefined || (widthMode == YGMeasureModeAtMost && width > 10) ? 10 : width, + .height = heightMode == YGMeasureModeUndefined || (heightMode == YGMeasureModeAtMost && height > 10) ? 10 : height, }; } TEST(CSSLayoutTest, measure_once_single_flexible_child) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); - CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); + CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow); + CSSNodeStyleSetAlignItems(root, YGAlignFlexStart); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -53,7 +53,7 @@ TEST(CSSLayoutTest, measure_once_single_flexible_child) { CSSNodeStyleSetFlexGrow(root_child0, 1); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_EQ(1, measureCount); @@ -69,8 +69,8 @@ TEST(CSSLayoutTest, remeasure_with_same_exact_width_larger_than_needed_height) { CSSNodeSetMeasureFunc(root_child0, _measureMin); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, 100, 100, CSSDirectionLTR); - CSSNodeCalculateLayout(root, 100, 50, CSSDirectionLTR); + CSSNodeCalculateLayout(root, 100, 100, YGDirectionLTR); + CSSNodeCalculateLayout(root, 100, 50, YGDirectionLTR); ASSERT_EQ(1, measureCount); @@ -79,7 +79,7 @@ TEST(CSSLayoutTest, remeasure_with_same_exact_width_larger_than_needed_height) { TEST(CSSLayoutTest, remeasure_with_same_atmost_width_larger_than_needed_height) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); + CSSNodeStyleSetAlignItems(root, YGAlignFlexStart); const CSSNodeRef root_child0 = CSSNodeNew(); int measureCount = 0; @@ -87,8 +87,8 @@ TEST(CSSLayoutTest, remeasure_with_same_atmost_width_larger_than_needed_height) CSSNodeSetMeasureFunc(root_child0, _measureMin); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, 100, 100, CSSDirectionLTR); - CSSNodeCalculateLayout(root, 100, 50, CSSDirectionLTR); + CSSNodeCalculateLayout(root, 100, 100, YGDirectionLTR); + CSSNodeCalculateLayout(root, 100, 50, YGDirectionLTR); ASSERT_EQ(1, measureCount); @@ -97,7 +97,7 @@ TEST(CSSLayoutTest, remeasure_with_same_atmost_width_larger_than_needed_height) TEST(CSSLayoutTest, remeasure_with_computed_width_larger_than_needed_height) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); + CSSNodeStyleSetAlignItems(root, YGAlignFlexStart); const CSSNodeRef root_child0 = CSSNodeNew(); int measureCount = 0; @@ -105,9 +105,9 @@ TEST(CSSLayoutTest, remeasure_with_computed_width_larger_than_needed_height) { CSSNodeSetMeasureFunc(root_child0, _measureMin); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, 100, 100, CSSDirectionLTR); - CSSNodeStyleSetAlignItems(root, CSSAlignStretch); - CSSNodeCalculateLayout(root, 10, 50, CSSDirectionLTR); + CSSNodeCalculateLayout(root, 100, 100, YGDirectionLTR); + CSSNodeStyleSetAlignItems(root, YGAlignStretch); + CSSNodeCalculateLayout(root, 10, 50, YGDirectionLTR); ASSERT_EQ(1, measureCount); @@ -116,7 +116,7 @@ TEST(CSSLayoutTest, remeasure_with_computed_width_larger_than_needed_height) { TEST(CSSLayoutTest, remeasure_with_atmost_computed_width_undefined_height) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); + CSSNodeStyleSetAlignItems(root, YGAlignFlexStart); const CSSNodeRef root_child0 = CSSNodeNew(); int measureCount = 0; @@ -124,8 +124,8 @@ TEST(CSSLayoutTest, remeasure_with_atmost_computed_width_undefined_height) { CSSNodeSetMeasureFunc(root_child0, _measureMin); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, 100, CSSUndefined, CSSDirectionLTR); - CSSNodeCalculateLayout(root, 10, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, 100, YGUndefined, YGDirectionLTR); + CSSNodeCalculateLayout(root, 10, YGUndefined, YGDirectionLTR); ASSERT_EQ(1, measureCount); diff --git a/tests/CSSLayoutMeasureModeTest.cpp b/tests/CSSLayoutMeasureModeTest.cpp index cc946fc1..df86878c 100644 --- a/tests/CSSLayoutMeasureModeTest.cpp +++ b/tests/CSSLayoutMeasureModeTest.cpp @@ -12,9 +12,9 @@ struct _MeasureConstraint { float width; - CSSMeasureMode widthMode; + YGMeasureMode widthMode; float height; - CSSMeasureMode heightMode; + YGMeasureMode heightMode; }; struct _MeasureConstraintList { @@ -24,9 +24,9 @@ struct _MeasureConstraintList { static CSSSize _measure(CSSNodeRef node, float width, - CSSMeasureMode widthMode, + YGMeasureMode widthMode, float height, - CSSMeasureMode heightMode) { + YGMeasureMode heightMode) { struct _MeasureConstraintList *constraintList = (struct _MeasureConstraintList *)CSSNodeGetContext(node); struct _MeasureConstraint *constraints = constraintList->constraints; uint32_t currentIndex = constraintList->length; @@ -37,8 +37,8 @@ static CSSSize _measure(CSSNodeRef node, constraintList->length = currentIndex + 1; return CSSSize { - .width = widthMode == CSSMeasureModeUndefined ? 10 : width, - .height = heightMode == CSSMeasureModeUndefined ? 10 : width, + .width = widthMode == YGMeasureModeUndefined ? 10 : width, + .height = heightMode == YGMeasureModeUndefined ? 10 : width, }; } @@ -57,12 +57,12 @@ TEST(CSSLayoutTest, exactly_measure_stretched_child_column) { CSSNodeSetMeasureFunc(root_child0, _measure); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_EQ(1, constraintList.length); ASSERT_FLOAT_EQ(100, constraintList.constraints[0].width); - ASSERT_EQ(CSSMeasureModeExactly, constraintList.constraints[0].widthMode); + ASSERT_EQ(YGMeasureModeExactly, constraintList.constraints[0].widthMode); free(constraintList.constraints); CSSNodeFreeRecursive(root); @@ -75,7 +75,7 @@ TEST(CSSLayoutTest, exactly_measure_stretched_child_row) { }; const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); + CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -84,12 +84,12 @@ TEST(CSSLayoutTest, exactly_measure_stretched_child_row) { CSSNodeSetMeasureFunc(root_child0, _measure); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_EQ(1, constraintList.length); ASSERT_FLOAT_EQ(100, constraintList.constraints[0].height); - ASSERT_EQ(CSSMeasureModeExactly, constraintList.constraints[0].heightMode); + ASSERT_EQ(YGMeasureModeExactly, constraintList.constraints[0].heightMode); free(constraintList.constraints); CSSNodeFreeRecursive(root); @@ -110,12 +110,12 @@ TEST(CSSLayoutTest, at_most_main_axis_column) { CSSNodeSetMeasureFunc(root_child0, _measure); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_EQ(1, constraintList.length); ASSERT_FLOAT_EQ(100, constraintList.constraints[0].height); - ASSERT_EQ(CSSMeasureModeAtMost, constraintList.constraints[0].heightMode); + ASSERT_EQ(YGMeasureModeAtMost, constraintList.constraints[0].heightMode); free(constraintList.constraints); CSSNodeFreeRecursive(root); @@ -128,7 +128,7 @@ TEST(CSSLayoutTest, at_most_cross_axis_column) { }; const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); + CSSNodeStyleSetAlignItems(root, YGAlignFlexStart); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -137,12 +137,12 @@ TEST(CSSLayoutTest, at_most_cross_axis_column) { CSSNodeSetMeasureFunc(root_child0, _measure); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_EQ(1, constraintList.length); ASSERT_FLOAT_EQ(100, constraintList.constraints[0].width); - ASSERT_EQ(CSSMeasureModeAtMost, constraintList.constraints[0].widthMode); + ASSERT_EQ(YGMeasureModeAtMost, constraintList.constraints[0].widthMode); free(constraintList.constraints); CSSNodeFreeRecursive(root); @@ -155,7 +155,7 @@ TEST(CSSLayoutTest, at_most_main_axis_row) { }; const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); + CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -164,12 +164,12 @@ TEST(CSSLayoutTest, at_most_main_axis_row) { CSSNodeSetMeasureFunc(root_child0, _measure); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_EQ(1, constraintList.length); ASSERT_FLOAT_EQ(100, constraintList.constraints[0].width); - ASSERT_EQ(CSSMeasureModeAtMost, constraintList.constraints[0].widthMode); + ASSERT_EQ(YGMeasureModeAtMost, constraintList.constraints[0].widthMode); free(constraintList.constraints); CSSNodeFreeRecursive(root); @@ -182,8 +182,8 @@ TEST(CSSLayoutTest, at_most_cross_axis_row) { }; const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); - CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); + CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow); + CSSNodeStyleSetAlignItems(root, YGAlignFlexStart); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -192,12 +192,12 @@ TEST(CSSLayoutTest, at_most_cross_axis_row) { CSSNodeSetMeasureFunc(root_child0, _measure); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_EQ(1, constraintList.length); ASSERT_FLOAT_EQ(100, constraintList.constraints[0].height); - ASSERT_EQ(CSSMeasureModeAtMost, constraintList.constraints[0].heightMode); + ASSERT_EQ(YGMeasureModeAtMost, constraintList.constraints[0].heightMode); free(constraintList.constraints); CSSNodeFreeRecursive(root); @@ -218,15 +218,15 @@ TEST(CSSLayoutTest, flex_child) { CSSNodeSetMeasureFunc(root_child0, _measure); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_EQ(2, constraintList.length); ASSERT_FLOAT_EQ(100, constraintList.constraints[0].height); - ASSERT_EQ(CSSMeasureModeAtMost, constraintList.constraints[0].heightMode); + ASSERT_EQ(YGMeasureModeAtMost, constraintList.constraints[0].heightMode); ASSERT_FLOAT_EQ(100, constraintList.constraints[1].height); - ASSERT_EQ(CSSMeasureModeExactly, constraintList.constraints[1].heightMode); + ASSERT_EQ(YGMeasureModeExactly, constraintList.constraints[1].heightMode); free(constraintList.constraints); CSSNodeFreeRecursive(root); @@ -248,12 +248,12 @@ TEST(CSSLayoutTest, flex_child_with_flex_basis) { CSSNodeSetMeasureFunc(root_child0, _measure); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_EQ(1, constraintList.length); ASSERT_FLOAT_EQ(100, constraintList.constraints[0].height); - ASSERT_EQ(CSSMeasureModeExactly, constraintList.constraints[0].heightMode); + ASSERT_EQ(YGMeasureModeExactly, constraintList.constraints[0].heightMode); free(constraintList.constraints); CSSNodeFreeRecursive(root); @@ -266,8 +266,8 @@ TEST(CSSLayoutTest, overflow_scroll_column) { }; const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); - CSSNodeStyleSetOverflow(root, CSSOverflowScroll); + CSSNodeStyleSetAlignItems(root, YGAlignFlexStart); + CSSNodeStyleSetOverflow(root, YGOverflowScroll); CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetWidth(root, 100); @@ -276,15 +276,15 @@ TEST(CSSLayoutTest, overflow_scroll_column) { CSSNodeSetMeasureFunc(root_child0, _measure); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_EQ(1, constraintList.length); ASSERT_FLOAT_EQ(100, constraintList.constraints[0].width); - ASSERT_EQ(CSSMeasureModeAtMost, constraintList.constraints[0].widthMode); + ASSERT_EQ(YGMeasureModeAtMost, constraintList.constraints[0].widthMode); ASSERT_TRUE(CSSValueIsUndefined(constraintList.constraints[0].height)); - ASSERT_EQ(CSSMeasureModeUndefined, constraintList.constraints[0].heightMode); + ASSERT_EQ(YGMeasureModeUndefined, constraintList.constraints[0].heightMode); free(constraintList.constraints); CSSNodeFreeRecursive(root); @@ -297,9 +297,9 @@ TEST(CSSLayoutTest, overflow_scroll_row) { }; const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); - CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); - CSSNodeStyleSetOverflow(root, CSSOverflowScroll); + CSSNodeStyleSetAlignItems(root, YGAlignFlexStart); + CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow); + CSSNodeStyleSetOverflow(root, YGOverflowScroll); CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetWidth(root, 100); @@ -308,15 +308,15 @@ TEST(CSSLayoutTest, overflow_scroll_row) { CSSNodeSetMeasureFunc(root_child0, _measure); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_EQ(1, constraintList.length); ASSERT_TRUE(CSSValueIsUndefined(constraintList.constraints[0].width)); - ASSERT_EQ(CSSMeasureModeUndefined, constraintList.constraints[0].widthMode); + ASSERT_EQ(YGMeasureModeUndefined, constraintList.constraints[0].widthMode); ASSERT_FLOAT_EQ(100, constraintList.constraints[0].height); - ASSERT_EQ(CSSMeasureModeAtMost, constraintList.constraints[0].heightMode); + ASSERT_EQ(YGMeasureModeAtMost, constraintList.constraints[0].heightMode); free(constraintList.constraints); CSSNodeFreeRecursive(root); diff --git a/tests/CSSLayoutMeasureTest.cpp b/tests/CSSLayoutMeasureTest.cpp index 23ff7da3..4e84df94 100644 --- a/tests/CSSLayoutMeasureTest.cpp +++ b/tests/CSSLayoutMeasureTest.cpp @@ -12,9 +12,9 @@ static CSSSize _measure(CSSNodeRef node, float width, - CSSMeasureMode widthMode, + YGMeasureMode widthMode, float height, - CSSMeasureMode heightMode) { + YGMeasureMode heightMode) { int *measureCount = (int*) CSSNodeGetContext(node); if (measureCount) { (*measureCount)++; @@ -40,7 +40,7 @@ TEST(CSSLayoutTest, dont_measure_single_grow_shrink_child) { CSSNodeStyleSetFlexShrink(root_child0, 1); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_EQ(0, measureCount); diff --git a/tests/CSSLayoutMinMaxDimensionTest.cpp b/tests/CSSLayoutMinMaxDimensionTest.cpp index aaf2710a..3683464f 100644 --- a/tests/CSSLayoutMinMaxDimensionTest.cpp +++ b/tests/CSSLayoutMinMaxDimensionTest.cpp @@ -21,7 +21,7 @@ TEST(CSSLayoutTest, max_width) { CSSNodeStyleSetMaxWidth(root_child0, 50); CSSNodeStyleSetHeight(root_child0, 10); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -33,7 +33,7 @@ TEST(CSSLayoutTest, max_width) { ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -50,7 +50,7 @@ TEST(CSSLayoutTest, max_width) { TEST(CSSLayoutTest, max_height) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); + CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -58,7 +58,7 @@ TEST(CSSLayoutTest, max_height) { CSSNodeStyleSetWidth(root_child0, 10); CSSNodeStyleSetMaxHeight(root_child0, 50); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -70,7 +70,7 @@ TEST(CSSLayoutTest, max_height) { ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetHeight(root_child0)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -98,7 +98,7 @@ TEST(CSSLayoutTest, min_height) { const CSSNodeRef root_child1 = CSSNodeNew(); CSSNodeStyleSetFlexGrow(root_child1, 1); CSSNodeInsertChild(root, root_child1, 1); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -115,7 +115,7 @@ TEST(CSSLayoutTest, min_height) { ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child1)); ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetHeight(root_child1)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -137,7 +137,7 @@ TEST(CSSLayoutTest, min_height) { TEST(CSSLayoutTest, min_width) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); + CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -149,7 +149,7 @@ TEST(CSSLayoutTest, min_width) { const CSSNodeRef root_child1 = CSSNodeNew(); CSSNodeStyleSetFlexGrow(root_child1, 1); CSSNodeInsertChild(root, root_child1, 1); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -166,7 +166,7 @@ TEST(CSSLayoutTest, min_width) { ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetWidth(root_child1)); ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child1)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -188,7 +188,7 @@ TEST(CSSLayoutTest, min_width) { TEST(CSSLayoutTest, justify_content_min_max) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetJustifyContent(root, CSSJustifyCenter); + CSSNodeStyleSetJustifyContent(root, YGJustifyCenter); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetMinHeight(root, 100); CSSNodeStyleSetMaxHeight(root, 200); @@ -197,7 +197,7 @@ TEST(CSSLayoutTest, justify_content_min_max) { CSSNodeStyleSetWidth(root_child0, 60); CSSNodeStyleSetHeight(root_child0, 60); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -209,7 +209,7 @@ TEST(CSSLayoutTest, justify_content_min_max) { ASSERT_FLOAT_EQ(60, CSSNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(60, CSSNodeLayoutGetHeight(root_child0)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -226,7 +226,7 @@ TEST(CSSLayoutTest, justify_content_min_max) { TEST(CSSLayoutTest, align_items_min_max) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetAlignItems(root, CSSAlignCenter); + CSSNodeStyleSetAlignItems(root, YGAlignCenter); CSSNodeStyleSetMinWidth(root, 100); CSSNodeStyleSetMaxWidth(root, 200); CSSNodeStyleSetHeight(root, 100); @@ -235,7 +235,7 @@ TEST(CSSLayoutTest, align_items_min_max) { CSSNodeStyleSetWidth(root_child0, 60); CSSNodeStyleSetHeight(root_child0, 60); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -247,7 +247,7 @@ TEST(CSSLayoutTest, align_items_min_max) { ASSERT_FLOAT_EQ(60, CSSNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(60, CSSNodeLayoutGetHeight(root_child0)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -264,7 +264,7 @@ TEST(CSSLayoutTest, align_items_min_max) { TEST(CSSLayoutTest, justify_content_overflow_min_max) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetJustifyContent(root, CSSJustifyCenter); + CSSNodeStyleSetJustifyContent(root, YGJustifyCenter); CSSNodeStyleSetMinHeight(root, 100); CSSNodeStyleSetMaxHeight(root, 110); @@ -282,7 +282,7 @@ TEST(CSSLayoutTest, justify_content_overflow_min_max) { CSSNodeStyleSetWidth(root_child2, 50); CSSNodeStyleSetHeight(root_child2, 50); CSSNodeInsertChild(root, root_child2, 2); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -304,7 +304,7 @@ TEST(CSSLayoutTest, justify_content_overflow_min_max) { ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetWidth(root_child2)); ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetHeight(root_child2)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -335,7 +335,7 @@ TEST(CSSLayoutTest, flex_grow_within_max_width) { CSSNodeStyleSetHeight(root, 100); const CSSNodeRef root_child0 = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(root_child0, CSSFlexDirectionRow); + CSSNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow); CSSNodeStyleSetMaxWidth(root_child0, 100); CSSNodeInsertChild(root, root_child0, 0); @@ -343,7 +343,7 @@ TEST(CSSLayoutTest, flex_grow_within_max_width) { CSSNodeStyleSetFlexGrow(root_child0_child0, 1); CSSNodeStyleSetHeight(root_child0_child0, 20); CSSNodeInsertChild(root_child0, root_child0_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -360,7 +360,7 @@ TEST(CSSLayoutTest, flex_grow_within_max_width) { ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child0_child0)); ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetHeight(root_child0_child0)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -386,7 +386,7 @@ TEST(CSSLayoutTest, flex_grow_within_constrained_max_width) { CSSNodeStyleSetHeight(root, 100); const CSSNodeRef root_child0 = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(root_child0, CSSFlexDirectionRow); + CSSNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow); CSSNodeStyleSetMaxWidth(root_child0, 300); CSSNodeInsertChild(root, root_child0, 0); @@ -394,7 +394,7 @@ TEST(CSSLayoutTest, flex_grow_within_constrained_max_width) { CSSNodeStyleSetFlexGrow(root_child0_child0, 1); CSSNodeStyleSetHeight(root_child0_child0, 20); CSSNodeInsertChild(root_child0, root_child0_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -411,7 +411,7 @@ TEST(CSSLayoutTest, flex_grow_within_constrained_max_width) { ASSERT_FLOAT_EQ(200, CSSNodeLayoutGetWidth(root_child0_child0)); ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetHeight(root_child0_child0)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); diff --git a/tests/CSSLayoutPaddingTest.cpp b/tests/CSSLayoutPaddingTest.cpp index 355c7d3c..2b9fae89 100644 --- a/tests/CSSLayoutPaddingTest.cpp +++ b/tests/CSSLayoutPaddingTest.cpp @@ -14,18 +14,18 @@ TEST(CSSLayoutTest, padding_no_size) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetPadding(root, CSSEdgeLeft, 10); - CSSNodeStyleSetPadding(root, CSSEdgeTop, 10); - CSSNodeStyleSetPadding(root, CSSEdgeRight, 10); - CSSNodeStyleSetPadding(root, CSSEdgeBottom, 10); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeStyleSetPadding(root, YGEdgeLeft, 10); + CSSNodeStyleSetPadding(root, YGEdgeTop, 10); + CSSNodeStyleSetPadding(root, YGEdgeRight, 10); + CSSNodeStyleSetPadding(root, YGEdgeBottom, 10); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetWidth(root)); ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetHeight(root)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -37,16 +37,16 @@ TEST(CSSLayoutTest, padding_no_size) { TEST(CSSLayoutTest, padding_container_match_child) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetPadding(root, CSSEdgeLeft, 10); - CSSNodeStyleSetPadding(root, CSSEdgeTop, 10); - CSSNodeStyleSetPadding(root, CSSEdgeRight, 10); - CSSNodeStyleSetPadding(root, CSSEdgeBottom, 10); + CSSNodeStyleSetPadding(root, YGEdgeLeft, 10); + CSSNodeStyleSetPadding(root, YGEdgeTop, 10); + CSSNodeStyleSetPadding(root, YGEdgeRight, 10); + CSSNodeStyleSetPadding(root, YGEdgeBottom, 10); const CSSNodeRef root_child0 = CSSNodeNew(); CSSNodeStyleSetWidth(root_child0, 10); CSSNodeStyleSetHeight(root_child0, 10); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -58,7 +58,7 @@ TEST(CSSLayoutTest, padding_container_match_child) { ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -75,10 +75,10 @@ TEST(CSSLayoutTest, padding_container_match_child) { TEST(CSSLayoutTest, padding_flex_child) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetPadding(root, CSSEdgeLeft, 10); - CSSNodeStyleSetPadding(root, CSSEdgeTop, 10); - CSSNodeStyleSetPadding(root, CSSEdgeRight, 10); - CSSNodeStyleSetPadding(root, CSSEdgeBottom, 10); + CSSNodeStyleSetPadding(root, YGEdgeLeft, 10); + CSSNodeStyleSetPadding(root, YGEdgeTop, 10); + CSSNodeStyleSetPadding(root, YGEdgeRight, 10); + CSSNodeStyleSetPadding(root, YGEdgeBottom, 10); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -86,7 +86,7 @@ TEST(CSSLayoutTest, padding_flex_child) { CSSNodeStyleSetFlexGrow(root_child0, 1); CSSNodeStyleSetWidth(root_child0, 10); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -98,7 +98,7 @@ TEST(CSSLayoutTest, padding_flex_child) { ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(80, CSSNodeLayoutGetHeight(root_child0)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -115,17 +115,17 @@ TEST(CSSLayoutTest, padding_flex_child) { TEST(CSSLayoutTest, padding_stretch_child) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetPadding(root, CSSEdgeLeft, 10); - CSSNodeStyleSetPadding(root, CSSEdgeTop, 10); - CSSNodeStyleSetPadding(root, CSSEdgeRight, 10); - CSSNodeStyleSetPadding(root, CSSEdgeBottom, 10); + CSSNodeStyleSetPadding(root, YGEdgeLeft, 10); + CSSNodeStyleSetPadding(root, YGEdgeTop, 10); + CSSNodeStyleSetPadding(root, YGEdgeRight, 10); + CSSNodeStyleSetPadding(root, YGEdgeBottom, 10); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); const CSSNodeRef root_child0 = CSSNodeNew(); CSSNodeStyleSetHeight(root_child0, 10); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -137,7 +137,7 @@ TEST(CSSLayoutTest, padding_stretch_child) { ASSERT_FLOAT_EQ(80, CSSNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -154,11 +154,11 @@ TEST(CSSLayoutTest, padding_stretch_child) { TEST(CSSLayoutTest, padding_center_child) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetJustifyContent(root, CSSJustifyCenter); - CSSNodeStyleSetAlignItems(root, CSSAlignCenter); - CSSNodeStyleSetPadding(root, CSSEdgeStart, 10); - CSSNodeStyleSetPadding(root, CSSEdgeEnd, 20); - CSSNodeStyleSetPadding(root, CSSEdgeBottom, 20); + CSSNodeStyleSetJustifyContent(root, YGJustifyCenter); + CSSNodeStyleSetAlignItems(root, YGAlignCenter); + CSSNodeStyleSetPadding(root, YGEdgeStart, 10); + CSSNodeStyleSetPadding(root, YGEdgeEnd, 20); + CSSNodeStyleSetPadding(root, YGEdgeBottom, 20); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -166,7 +166,7 @@ TEST(CSSLayoutTest, padding_center_child) { CSSNodeStyleSetWidth(root_child0, 10); CSSNodeStyleSetHeight(root_child0, 10); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -178,7 +178,7 @@ TEST(CSSLayoutTest, padding_center_child) { ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -195,20 +195,20 @@ TEST(CSSLayoutTest, padding_center_child) { TEST(CSSLayoutTest, child_with_padding_align_end) { const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetJustifyContent(root, CSSJustifyFlexEnd); - CSSNodeStyleSetAlignItems(root, CSSAlignFlexEnd); + CSSNodeStyleSetJustifyContent(root, YGJustifyFlexEnd); + CSSNodeStyleSetAlignItems(root, YGAlignFlexEnd); CSSNodeStyleSetWidth(root, 200); CSSNodeStyleSetHeight(root, 200); const CSSNodeRef root_child0 = CSSNodeNew(); - CSSNodeStyleSetPadding(root_child0, CSSEdgeLeft, 20); - CSSNodeStyleSetPadding(root_child0, CSSEdgeTop, 20); - CSSNodeStyleSetPadding(root_child0, CSSEdgeRight, 20); - CSSNodeStyleSetPadding(root_child0, CSSEdgeBottom, 20); + CSSNodeStyleSetPadding(root_child0, YGEdgeLeft, 20); + CSSNodeStyleSetPadding(root_child0, YGEdgeTop, 20); + CSSNodeStyleSetPadding(root_child0, YGEdgeRight, 20); + CSSNodeStyleSetPadding(root_child0, YGEdgeBottom, 20); CSSNodeStyleSetWidth(root_child0, 100); CSSNodeStyleSetHeight(root_child0, 100); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -220,7 +220,7 @@ TEST(CSSLayoutTest, child_with_padding_align_end) { ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child0)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); diff --git a/tests/CSSLayoutRelayoutTest.cpp b/tests/CSSLayoutRelayoutTest.cpp index ee4adb36..6028ed22 100644 --- a/tests/CSSLayoutRelayoutTest.cpp +++ b/tests/CSSLayoutRelayoutTest.cpp @@ -11,7 +11,7 @@ #include TEST(CSSLayoutTest, dont_cache_computed_flex_basis_between_layouts) { - CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureWebFlexBasis, true); + CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureWebFlexBasis, true); const CSSNodeRef root = CSSNodeNew(); @@ -20,12 +20,12 @@ TEST(CSSLayoutTest, dont_cache_computed_flex_basis_between_layouts) { CSSNodeStyleSetFlexBasis(root_child0, 20); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, 100, CSSUndefined, CSSDirectionLTR); - CSSNodeCalculateLayout(root, 100, 100, CSSDirectionLTR); + CSSNodeCalculateLayout(root, 100, YGUndefined, YGDirectionLTR); + CSSNodeCalculateLayout(root, 100, 100, YGDirectionLTR); ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetHeight(root_child0)); CSSNodeFreeRecursive(root); - CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureWebFlexBasis, false); + CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureWebFlexBasis, false); } diff --git a/tests/CSSLayoutRoundingMeasureFuncTest.cpp b/tests/CSSLayoutRoundingMeasureFuncTest.cpp index 85acd10e..afd8deb5 100644 --- a/tests/CSSLayoutRoundingMeasureFuncTest.cpp +++ b/tests/CSSLayoutRoundingMeasureFuncTest.cpp @@ -12,9 +12,9 @@ static CSSSize _measureFloor(CSSNodeRef node, float width, - CSSMeasureMode widthMode, + YGMeasureMode widthMode, float height, - CSSMeasureMode heightMode) { + YGMeasureMode heightMode) { return CSSSize{ width = 10.2, @@ -24,9 +24,9 @@ static CSSSize _measureFloor(CSSNodeRef node, static CSSSize _measureCeil(CSSNodeRef node, float width, - CSSMeasureMode widthMode, + YGMeasureMode widthMode, float height, - CSSMeasureMode heightMode) { + YGMeasureMode heightMode) { return CSSSize{ width = 10.5, @@ -35,7 +35,7 @@ static CSSSize _measureCeil(CSSNodeRef node, } TEST(CSSLayoutTest, rounding_feature_with_custom_measure_func_floor) { - CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, true); + CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true); const CSSNodeRef root = CSSNodeNew(); @@ -43,18 +43,18 @@ TEST(CSSLayoutTest, rounding_feature_with_custom_measure_func_floor) { CSSNodeSetMeasureFunc(root_child0, _measureFloor); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0)); CSSNodeFreeRecursive(root); - CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, false); + CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, false); } TEST(CSSLayoutTest, rounding_feature_with_custom_measure_func_ceil) { - CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, true); + CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true); const CSSNodeRef root = CSSNodeNew(); @@ -62,12 +62,12 @@ TEST(CSSLayoutTest, rounding_feature_with_custom_measure_func_ceil) { CSSNodeSetMeasureFunc(root_child0, _measureCeil); CSSNodeInsertChild(root, root_child0, 0); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(11, CSSNodeLayoutGetWidth(root_child0)); ASSERT_FLOAT_EQ(11, CSSNodeLayoutGetHeight(root_child0)); CSSNodeFreeRecursive(root); - CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, false); + CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, false); } diff --git a/tests/CSSLayoutRoundingTest.cpp b/tests/CSSLayoutRoundingTest.cpp index 9991dbaa..635370da 100644 --- a/tests/CSSLayoutRoundingTest.cpp +++ b/tests/CSSLayoutRoundingTest.cpp @@ -13,10 +13,10 @@ #include TEST(CSSLayoutTest, rounding_flex_basis_flex_grow_row_width_of_100) { - CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, true); + CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true); const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); + CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 100); @@ -31,7 +31,7 @@ TEST(CSSLayoutTest, rounding_flex_basis_flex_grow_row_width_of_100) { const CSSNodeRef root_child2 = CSSNodeNew(); CSSNodeStyleSetFlexGrow(root_child2, 1); CSSNodeInsertChild(root, root_child2, 2); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -53,7 +53,7 @@ TEST(CSSLayoutTest, rounding_flex_basis_flex_grow_row_width_of_100) { ASSERT_FLOAT_EQ(33, CSSNodeLayoutGetWidth(root_child2)); ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child2)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -77,14 +77,14 @@ TEST(CSSLayoutTest, rounding_flex_basis_flex_grow_row_width_of_100) { CSSNodeFreeRecursive(root); - CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, false); + CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, false); } TEST(CSSLayoutTest, rounding_flex_basis_flex_grow_row_prime_number_width) { - CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, true); + CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true); const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); + CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow); CSSNodeStyleSetWidth(root, 113); CSSNodeStyleSetHeight(root, 100); @@ -107,7 +107,7 @@ TEST(CSSLayoutTest, rounding_flex_basis_flex_grow_row_prime_number_width) { const CSSNodeRef root_child4 = CSSNodeNew(); CSSNodeStyleSetFlexGrow(root_child4, 1); CSSNodeInsertChild(root, root_child4, 4); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -139,7 +139,7 @@ TEST(CSSLayoutTest, rounding_flex_basis_flex_grow_row_prime_number_width) { ASSERT_FLOAT_EQ(23, CSSNodeLayoutGetWidth(root_child4)); ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child4)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -173,14 +173,14 @@ TEST(CSSLayoutTest, rounding_flex_basis_flex_grow_row_prime_number_width) { CSSNodeFreeRecursive(root); - CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, false); + CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, false); } TEST(CSSLayoutTest, rounding_flex_basis_flex_shrink_row) { - CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, true); + CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true); const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); + CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow); CSSNodeStyleSetWidth(root, 101); CSSNodeStyleSetHeight(root, 100); @@ -196,7 +196,7 @@ TEST(CSSLayoutTest, rounding_flex_basis_flex_shrink_row) { const CSSNodeRef root_child2 = CSSNodeNew(); CSSNodeStyleSetFlexBasis(root_child2, 25); CSSNodeInsertChild(root, root_child2, 2); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -218,7 +218,7 @@ TEST(CSSLayoutTest, rounding_flex_basis_flex_shrink_row) { ASSERT_FLOAT_EQ(25, CSSNodeLayoutGetWidth(root_child2)); ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child2)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -242,11 +242,11 @@ TEST(CSSLayoutTest, rounding_flex_basis_flex_shrink_row) { CSSNodeFreeRecursive(root); - CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, false); + CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, false); } TEST(CSSLayoutTest, rounding_flex_basis_overrides_main_size) { - CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, true); + CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true); const CSSNodeRef root = CSSNodeNew(); CSSNodeStyleSetWidth(root, 100); @@ -267,7 +267,7 @@ TEST(CSSLayoutTest, rounding_flex_basis_overrides_main_size) { CSSNodeStyleSetFlexGrow(root_child2, 1); CSSNodeStyleSetHeight(root_child2, 10); CSSNodeInsertChild(root, root_child2, 2); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -289,7 +289,7 @@ TEST(CSSLayoutTest, rounding_flex_basis_overrides_main_size) { ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child2)); ASSERT_FLOAT_EQ(24, CSSNodeLayoutGetHeight(root_child2)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -313,11 +313,11 @@ TEST(CSSLayoutTest, rounding_flex_basis_overrides_main_size) { CSSNodeFreeRecursive(root); - CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, false); + CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, false); } TEST(CSSLayoutTest, rounding_total_fractial) { - CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, true); + CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true); const CSSNodeRef root = CSSNodeNew(); CSSNodeStyleSetWidth(root, 87.4f); @@ -338,7 +338,7 @@ TEST(CSSLayoutTest, rounding_total_fractial) { CSSNodeStyleSetFlexGrow(root_child2, 1.1f); CSSNodeStyleSetHeight(root_child2, 10.7f); CSSNodeInsertChild(root, root_child2, 2); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -360,7 +360,7 @@ TEST(CSSLayoutTest, rounding_total_fractial) { ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root_child2)); ASSERT_FLOAT_EQ(24, CSSNodeLayoutGetHeight(root_child2)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -384,11 +384,11 @@ TEST(CSSLayoutTest, rounding_total_fractial) { CSSNodeFreeRecursive(root); - CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, false); + CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, false); } TEST(CSSLayoutTest, rounding_total_fractial_nested) { - CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, true); + CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true); const CSSNodeRef root = CSSNodeNew(); CSSNodeStyleSetWidth(root, 87.4f); @@ -403,14 +403,14 @@ TEST(CSSLayoutTest, rounding_total_fractial_nested) { const CSSNodeRef root_child0_child0 = CSSNodeNew(); CSSNodeStyleSetFlexGrow(root_child0_child0, 1); CSSNodeStyleSetFlexBasis(root_child0_child0, 0.3f); - CSSNodeStyleSetPosition(root_child0_child0, CSSEdgeBottom, 13.3f); + CSSNodeStyleSetPosition(root_child0_child0, YGEdgeBottom, 13.3f); CSSNodeStyleSetHeight(root_child0_child0, 9.9f); CSSNodeInsertChild(root_child0, root_child0_child0, 0); const CSSNodeRef root_child0_child1 = CSSNodeNew(); CSSNodeStyleSetFlexGrow(root_child0_child1, 4); CSSNodeStyleSetFlexBasis(root_child0_child1, 0.3f); - CSSNodeStyleSetPosition(root_child0_child1, CSSEdgeTop, 13.3f); + CSSNodeStyleSetPosition(root_child0_child1, YGEdgeTop, 13.3f); CSSNodeStyleSetHeight(root_child0_child1, 1.1f); CSSNodeInsertChild(root_child0, root_child0_child1, 1); @@ -423,7 +423,7 @@ TEST(CSSLayoutTest, rounding_total_fractial_nested) { CSSNodeStyleSetFlexGrow(root_child2, 1.1f); CSSNodeStyleSetHeight(root_child2, 10.7f); CSSNodeInsertChild(root, root_child2, 2); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -455,7 +455,7 @@ TEST(CSSLayoutTest, rounding_total_fractial_nested) { ASSERT_FLOAT_EQ(87, CSSNodeLayoutGetWidth(root_child2)); ASSERT_FLOAT_EQ(24, CSSNodeLayoutGetHeight(root_child2)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -489,11 +489,11 @@ TEST(CSSLayoutTest, rounding_total_fractial_nested) { CSSNodeFreeRecursive(root); - CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, false); + CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, false); } TEST(CSSLayoutTest, rounding_fractial_input_1) { - CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, true); + CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true); const CSSNodeRef root = CSSNodeNew(); CSSNodeStyleSetWidth(root, 100); @@ -514,7 +514,7 @@ TEST(CSSLayoutTest, rounding_fractial_input_1) { CSSNodeStyleSetFlexGrow(root_child2, 1); CSSNodeStyleSetHeight(root_child2, 10); CSSNodeInsertChild(root, root_child2, 2); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -536,7 +536,7 @@ TEST(CSSLayoutTest, rounding_fractial_input_1) { ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child2)); ASSERT_FLOAT_EQ(24, CSSNodeLayoutGetHeight(root_child2)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -560,11 +560,11 @@ TEST(CSSLayoutTest, rounding_fractial_input_1) { CSSNodeFreeRecursive(root); - CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, false); + CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, false); } TEST(CSSLayoutTest, rounding_fractial_input_2) { - CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, true); + CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true); const CSSNodeRef root = CSSNodeNew(); CSSNodeStyleSetWidth(root, 100); @@ -585,7 +585,7 @@ TEST(CSSLayoutTest, rounding_fractial_input_2) { CSSNodeStyleSetFlexGrow(root_child2, 1); CSSNodeStyleSetHeight(root_child2, 10); CSSNodeInsertChild(root, root_child2, 2); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -607,7 +607,7 @@ TEST(CSSLayoutTest, rounding_fractial_input_2) { ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child2)); ASSERT_FLOAT_EQ(25, CSSNodeLayoutGetHeight(root_child2)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -631,14 +631,14 @@ TEST(CSSLayoutTest, rounding_fractial_input_2) { CSSNodeFreeRecursive(root); - CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, false); + CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, false); } TEST(CSSLayoutTest, rounding_fractial_input_3) { - CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, true); + CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true); const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetPosition(root, CSSEdgeTop, 0.3f); + CSSNodeStyleSetPosition(root, YGEdgeTop, 0.3f); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 113.4f); @@ -657,7 +657,7 @@ TEST(CSSLayoutTest, rounding_fractial_input_3) { CSSNodeStyleSetFlexGrow(root_child2, 1); CSSNodeStyleSetHeight(root_child2, 10); CSSNodeInsertChild(root, root_child2, 2); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -679,7 +679,7 @@ TEST(CSSLayoutTest, rounding_fractial_input_3) { ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child2)); ASSERT_FLOAT_EQ(24, CSSNodeLayoutGetHeight(root_child2)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); @@ -703,14 +703,14 @@ TEST(CSSLayoutTest, rounding_fractial_input_3) { CSSNodeFreeRecursive(root); - CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, false); + CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, false); } TEST(CSSLayoutTest, rounding_fractial_input_4) { - CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, true); + CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, true); const CSSNodeRef root = CSSNodeNew(); - CSSNodeStyleSetPosition(root, CSSEdgeTop, 0.7f); + CSSNodeStyleSetPosition(root, YGEdgeTop, 0.7f); CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetHeight(root, 113.4f); @@ -729,7 +729,7 @@ TEST(CSSLayoutTest, rounding_fractial_input_4) { CSSNodeStyleSetFlexGrow(root_child2, 1); CSSNodeStyleSetHeight(root_child2, 10); CSSNodeInsertChild(root, root_child2, 2); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(1, CSSNodeLayoutGetTop(root)); @@ -751,7 +751,7 @@ TEST(CSSLayoutTest, rounding_fractial_input_4) { ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child2)); ASSERT_FLOAT_EQ(24, CSSNodeLayoutGetHeight(root_child2)); - CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL); + CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(1, CSSNodeLayoutGetTop(root)); @@ -775,5 +775,5 @@ TEST(CSSLayoutTest, rounding_fractial_input_4) { CSSNodeFreeRecursive(root); - CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureRounding, false); + CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureRounding, false); } diff --git a/tests/CSSLayoutStyleTest.cpp b/tests/CSSLayoutStyleTest.cpp index 0ff51890..fe2a7827 100644 --- a/tests/CSSLayoutStyleTest.cpp +++ b/tests/CSSLayoutStyleTest.cpp @@ -25,16 +25,16 @@ TEST(CSSLayoutTest, copy_style_same) { TEST(CSSLayoutTest, copy_style_modified) { const CSSNodeRef node0 = CSSNodeNew(); ASSERT_FALSE(CSSNodeIsDirty(node0)); - ASSERT_EQ(CSSFlexDirectionColumn, CSSNodeStyleGetFlexDirection(node0)); + ASSERT_EQ(YGFlexDirectionColumn, CSSNodeStyleGetFlexDirection(node0)); ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetMaxHeight(node0))); const CSSNodeRef node1 = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(node1, CSSFlexDirectionRow); + CSSNodeStyleSetFlexDirection(node1, YGFlexDirectionRow); CSSNodeStyleSetMaxHeight(node1, 10); CSSNodeCopyStyle(node0, node1); ASSERT_TRUE(CSSNodeIsDirty(node0)); - ASSERT_EQ(CSSFlexDirectionRow, CSSNodeStyleGetFlexDirection(node0)); + ASSERT_EQ(YGFlexDirectionRow, CSSNodeStyleGetFlexDirection(node0)); ASSERT_FLOAT_EQ(10, CSSNodeStyleGetMaxHeight(node0)); CSSNodeFree(node0); @@ -43,13 +43,13 @@ TEST(CSSLayoutTest, copy_style_modified) { TEST(CSSLayoutTest, copy_style_modified_same) { const CSSNodeRef node0 = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(node0, CSSFlexDirectionRow); + CSSNodeStyleSetFlexDirection(node0, YGFlexDirectionRow); CSSNodeStyleSetMaxHeight(node0, 10); - CSSNodeCalculateLayout(node0, CSSUndefined, CSSUndefined, CSSDirectionLTR); + CSSNodeCalculateLayout(node0, YGUndefined, YGUndefined, YGDirectionLTR); ASSERT_FALSE(CSSNodeIsDirty(node0)); const CSSNodeRef node1 = CSSNodeNew(); - CSSNodeStyleSetFlexDirection(node1, CSSFlexDirectionRow); + CSSNodeStyleSetFlexDirection(node1, YGFlexDirectionRow); CSSNodeStyleSetMaxHeight(node1, 10); CSSNodeCopyStyle(node0, node1);