Rename enums

Summary: new name, start by renaming enums

Differential Revision: D4244360

fbshipit-source-id: c9fcbdd231098c9ff230a6055676bbc7cbd11001
This commit is contained in:
Emil Sjolander
2016-12-02 05:47:43 -08:00
committed by Facebook Github Bot
parent 07cf47baad
commit 42b6f6b6e5
107 changed files with 2546 additions and 2562 deletions

View File

@@ -7,102 +7,102 @@
* of patent rights can be found in the PATENTS file in the same directory. * of patent rights can be found in the PATENTS file in the same directory.
*/ */
typedef enum CSSOverflow { typedef enum YGFlexDirection {
CSSOverflowVisible, YGFlexDirectionColumn,
CSSOverflowHidden, YGFlexDirectionColumnReverse,
CSSOverflowScroll, YGFlexDirectionRow,
CSSOverflowCount, YGFlexDirectionRowReverse,
} CSSOverflow; YGFlexDirectionCount,
} YGFlexDirection;
typedef enum CSSJustify { typedef enum YGMeasureMode {
CSSJustifyFlexStart, YGMeasureModeUndefined,
CSSJustifyCenter, YGMeasureModeExactly,
CSSJustifyFlexEnd, YGMeasureModeAtMost,
CSSJustifySpaceBetween, YGMeasureModeCount,
CSSJustifySpaceAround, } YGMeasureMode;
CSSJustifyCount,
} CSSJustify;
typedef enum CSSFlexDirection { typedef enum YGPrintOptions {
CSSFlexDirectionColumn, YGPrintOptionsLayout = 1,
CSSFlexDirectionColumnReverse, YGPrintOptionsStyle = 2,
CSSFlexDirectionRow, YGPrintOptionsChildren = 4,
CSSFlexDirectionRowReverse, YGPrintOptionsCount,
CSSFlexDirectionCount, } YGPrintOptions;
} CSSFlexDirection;
typedef enum CSSAlign { typedef enum YGEdge {
CSSAlignAuto, YGEdgeLeft,
CSSAlignFlexStart, YGEdgeTop,
CSSAlignCenter, YGEdgeRight,
CSSAlignFlexEnd, YGEdgeBottom,
CSSAlignStretch, YGEdgeStart,
CSSAlignCount, YGEdgeEnd,
} CSSAlign; YGEdgeHorizontal,
YGEdgeVertical,
YGEdgeAll,
YGEdgeCount,
} YGEdge;
typedef enum CSSEdge { typedef enum YGPositionType {
CSSEdgeLeft, YGPositionTypeRelative,
CSSEdgeTop, YGPositionTypeAbsolute,
CSSEdgeRight, YGPositionTypeCount,
CSSEdgeBottom, } YGPositionType;
CSSEdgeStart,
CSSEdgeEnd,
CSSEdgeHorizontal,
CSSEdgeVertical,
CSSEdgeAll,
CSSEdgeCount,
} CSSEdge;
typedef enum CSSWrap { typedef enum YGDimension {
CSSWrapNoWrap, YGDimensionWidth,
CSSWrapWrap, YGDimensionHeight,
CSSWrapCount, YGDimensionCount,
} CSSWrap; } YGDimension;
typedef enum CSSDirection { typedef enum YGJustify {
CSSDirectionInherit, YGJustifyFlexStart,
CSSDirectionLTR, YGJustifyCenter,
CSSDirectionRTL, YGJustifyFlexEnd,
CSSDirectionCount, YGJustifySpaceBetween,
} CSSDirection; YGJustifySpaceAround,
YGJustifyCount,
} YGJustify;
typedef enum CSSExperimentalFeature { typedef enum YGDirection {
CSSExperimentalFeatureRounding, YGDirectionInherit,
CSSExperimentalFeatureWebFlexBasis, YGDirectionLTR,
CSSExperimentalFeatureCount, YGDirectionRTL,
} CSSExperimentalFeature; YGDirectionCount,
} YGDirection;
typedef enum CSSLogLevel { typedef enum YGLogLevel {
CSSLogLevelError, YGLogLevelError,
CSSLogLevelWarn, YGLogLevelWarn,
CSSLogLevelInfo, YGLogLevelInfo,
CSSLogLevelDebug, YGLogLevelDebug,
CSSLogLevelVerbose, YGLogLevelVerbose,
CSSLogLevelCount, YGLogLevelCount,
} CSSLogLevel; } YGLogLevel;
typedef enum CSSDimension { typedef enum YGWrap {
CSSDimensionWidth, YGWrapNoWrap,
CSSDimensionHeight, YGWrapWrap,
CSSDimensionCount, YGWrapCount,
} CSSDimension; } YGWrap;
typedef enum CSSMeasureMode { typedef enum YGOverflow {
CSSMeasureModeUndefined, YGOverflowVisible,
CSSMeasureModeExactly, YGOverflowHidden,
CSSMeasureModeAtMost, YGOverflowScroll,
CSSMeasureModeCount, YGOverflowCount,
} CSSMeasureMode; } YGOverflow;
typedef enum CSSPositionType { typedef enum YGExperimentalFeature {
CSSPositionTypeRelative, YGExperimentalFeatureRounding,
CSSPositionTypeAbsolute, YGExperimentalFeatureWebFlexBasis,
CSSPositionTypeCount, YGExperimentalFeatureCount,
} CSSPositionType; } YGExperimentalFeature;
typedef enum CSSPrintOptions { typedef enum YGAlign {
CSSPrintOptionsLayout = 1, YGAlignAuto,
CSSPrintOptionsStyle = 2, YGAlignFlexStart,
CSSPrintOptionsChildren = 4, YGAlignCenter,
CSSPrintOptionsCount, YGAlignFlexEnd,
} CSSPrintOptions; YGAlignStretch,
YGAlignCount,
} YGAlign;

File diff suppressed because it is too large Load Diff

View File

@@ -26,7 +26,7 @@ static const unsigned long __nan[2] = {0xffffffff, 0x7fffffff};
#define NAN (*(const float *) __nan) #define NAN (*(const float *) __nan)
#endif #endif
#define CSSUndefined NAN #define YGUndefined NAN
#include "CSSEnums.h" #include "CSSEnums.h"
#include "CSSMacros.h" #include "CSSMacros.h"
@@ -41,11 +41,11 @@ typedef struct CSSSize {
typedef struct CSSNode *CSSNodeRef; typedef struct CSSNode *CSSNodeRef;
typedef CSSSize (*CSSMeasureFunc)(CSSNodeRef node, typedef CSSSize (*CSSMeasureFunc)(CSSNodeRef node,
float width, float width,
CSSMeasureMode widthMode, YGMeasureMode widthMode,
float height, float height,
CSSMeasureMode heightMode); YGMeasureMode heightMode);
typedef void (*CSSPrintFunc)(CSSNodeRef node); 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 *(*CSSMalloc)(size_t size);
typedef void *(*CSSCalloc)(size_t count, 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, WIN_EXPORT void CSSNodeCalculateLayout(const CSSNodeRef node,
const float availableWidth, const float availableWidth,
const float availableHeight, const float availableHeight,
const CSSDirection parentDirection); const YGDirection parentDirection);
// Mark a node as dirty. Only valid for nodes with a custom measure function // Mark a node as dirty. Only valid for nodes with a custom measure function
// set. // set.
@@ -81,17 +81,17 @@ WIN_EXPORT void CSSNodeCalculateLayout(const CSSNodeRef node,
WIN_EXPORT void CSSNodeMarkDirty(const CSSNodeRef node); WIN_EXPORT void CSSNodeMarkDirty(const CSSNodeRef node);
WIN_EXPORT bool CSSNodeIsDirty(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 CSSValueIsUndefined(const float value);
WIN_EXPORT bool CSSNodeCanUseCachedMeasurement(const CSSMeasureMode widthMode, WIN_EXPORT bool CSSNodeCanUseCachedMeasurement(const YGMeasureMode widthMode,
const float width, const float width,
const CSSMeasureMode heightMode, const YGMeasureMode heightMode,
const float height, const float height,
const CSSMeasureMode lastWidthMode, const YGMeasureMode lastWidthMode,
const float lastWidth, const float lastWidth,
const CSSMeasureMode lastHeightMode, const YGMeasureMode lastHeightMode,
const float lastHeight, const float lastHeight,
const float lastComputedWidth, const float lastComputedWidth,
const float lastComputedHeight, 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) \ #define CSS_NODE_STYLE_EDGE_PROPERTY(type, name, paramName) \
WIN_EXPORT void CSSNodeStyleSet##name(const CSSNodeRef node, \ WIN_EXPORT void CSSNodeStyleSet##name(const CSSNodeRef node, \
const CSSEdge edge, \ const YGEdge edge, \
const type paramName); \ 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) \ #define CSS_NODE_LAYOUT_PROPERTY(type, name) \
WIN_EXPORT type CSSNodeLayoutGet##name(const CSSNodeRef node); 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(CSSPrintFunc, PrintFunc, printFunc);
CSS_NODE_PROPERTY(bool, HasNewLayout, hasNewLayout); CSS_NODE_PROPERTY(bool, HasNewLayout, hasNewLayout);
CSS_NODE_STYLE_PROPERTY(CSSDirection, Direction, direction); CSS_NODE_STYLE_PROPERTY(YGDirection, Direction, direction);
CSS_NODE_STYLE_PROPERTY(CSSFlexDirection, FlexDirection, flexDirection); CSS_NODE_STYLE_PROPERTY(YGFlexDirection, FlexDirection, flexDirection);
CSS_NODE_STYLE_PROPERTY(CSSJustify, JustifyContent, justifyContent); CSS_NODE_STYLE_PROPERTY(YGJustify, JustifyContent, justifyContent);
CSS_NODE_STYLE_PROPERTY(CSSAlign, AlignContent, alignContent); CSS_NODE_STYLE_PROPERTY(YGAlign, AlignContent, alignContent);
CSS_NODE_STYLE_PROPERTY(CSSAlign, AlignItems, alignItems); CSS_NODE_STYLE_PROPERTY(YGAlign, AlignItems, alignItems);
CSS_NODE_STYLE_PROPERTY(CSSAlign, AlignSelf, alignSelf); CSS_NODE_STYLE_PROPERTY(YGAlign, AlignSelf, alignSelf);
CSS_NODE_STYLE_PROPERTY(CSSPositionType, PositionType, positionType); CSS_NODE_STYLE_PROPERTY(YGPositionType, PositionType, positionType);
CSS_NODE_STYLE_PROPERTY(CSSWrap, FlexWrap, flexWrap); CSS_NODE_STYLE_PROPERTY(YGWrap, FlexWrap, flexWrap);
CSS_NODE_STYLE_PROPERTY(CSSOverflow, Overflow, overflow); CSS_NODE_STYLE_PROPERTY(YGOverflow, Overflow, overflow);
WIN_EXPORT void CSSNodeStyleSetFlex(const CSSNodeRef node, const float flex); WIN_EXPORT void CSSNodeStyleSetFlex(const CSSNodeRef node, const float flex);
CSS_NODE_STYLE_PROPERTY(float, FlexGrow, flexGrow); 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, Bottom);
CSS_NODE_LAYOUT_PROPERTY(float, Width); CSS_NODE_LAYOUT_PROPERTY(float, Width);
CSS_NODE_LAYOUT_PROPERTY(float, Height); 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 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, WIN_EXPORT void CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeature feature, bool enabled);
bool enabled); WIN_EXPORT bool CSSLayoutIsExperimentalFeatureEnabled(YGExperimentalFeature feature);
WIN_EXPORT bool CSSLayoutIsExperimentalFeatureEnabled(CSSExperimentalFeature feature);
WIN_EXPORT void CSSLayoutSetMemoryFuncs(CSSMalloc cssMalloc, WIN_EXPORT void CSSLayoutSetMemoryFuncs(CSSMalloc cssMalloc,
CSSCalloc cssCalloc, CSSCalloc cssCalloc,

View File

@@ -36,7 +36,7 @@
#ifndef CSS_ASSERT #ifndef CSS_ASSERT
#define CSS_ASSERT(X, message) \ #define CSS_ASSERT(X, message) \
if (!(X)) { \ if (!(X)) { \
CSSLog(CSSLogLevelError, "%s", message); \ CSSLog(YGLogLevelError, "%s", message); \
CSS_ABORT(); \ CSS_ABORT(); \
} }
#endif #endif

View File

@@ -74,8 +74,8 @@
{ {
UIView *container = [[UIView alloc] initWithFrame:CGRectZero]; UIView *container = [[UIView alloc] initWithFrame:CGRectZero];
[container css_setUsesFlexbox:YES]; [container css_setUsesFlexbox:YES];
[container css_setFlexDirection:CSSFlexDirectionRow]; [container css_setFlexDirection:YGFlexDirectionRow];
[container css_setAlignItems:CSSAlignFlexStart]; [container css_setAlignItems:YGAlignFlexStart];
UILabel *longTextLabel = [[UILabel alloc] initWithFrame:CGRectZero]; UILabel *longTextLabel = [[UILabel alloc] initWithFrame:CGRectZero];
longTextLabel.text = @"This is a very very very very very very very very long piece of text."; 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]; UIView *textBadgeView = [[UIView alloc] initWithFrame:CGRectZero];
[textBadgeView css_setUsesFlexbox:YES]; [textBadgeView css_setUsesFlexbox:YES];
[textBadgeView css_setMargin:3.0 forEdge:CSSEdgeLeft]; [textBadgeView css_setMargin:3.0 forEdge:YGEdgeLeft];
[textBadgeView css_setWidth:10]; [textBadgeView css_setWidth:10];
[textBadgeView css_setHeight:10]; [textBadgeView css_setHeight:10];
[container addSubview:textBadgeView]; [container addSubview:textBadgeView];
@@ -102,7 +102,7 @@
UIView *container = [[UIView alloc] initWithFrame:CGRectMake(0, 0, containerSize.width, containerSize.height)]; UIView *container = [[UIView alloc] initWithFrame:CGRectMake(0, 0, containerSize.width, containerSize.height)];
[container css_setUsesFlexbox:YES]; [container css_setUsesFlexbox:YES];
[container css_setFlexDirection:CSSFlexDirectionRow]; [container css_setFlexDirection:YGFlexDirectionRow];
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
UIView *subview = [[UIView alloc] initWithFrame:CGRectZero]; UIView *subview = [[UIView alloc] initWithFrame:CGRectZero];
@@ -131,7 +131,7 @@
UIView *container = [[UIView alloc] initWithFrame:CGRectMake(0, 0, containerSize.width, containerSize.height)]; UIView *container = [[UIView alloc] initWithFrame:CGRectMake(0, 0, containerSize.width, containerSize.height)];
[container css_setUsesFlexbox:YES]; [container css_setUsesFlexbox:YES];
[container css_setFlexDirection:CSSFlexDirectionRow]; [container css_setFlexDirection:YGFlexDirectionRow];
UIView *subview1 = [[UIView alloc] initWithFrame:CGRectZero]; UIView *subview1 = [[UIView alloc] initWithFrame:CGRectZero];
[subview1 css_setUsesFlexbox:YES]; [subview1 css_setUsesFlexbox:YES];
@@ -171,7 +171,7 @@
UIView *container = [[UIView alloc] initWithFrame:CGRectMake(0, 0, containerSize.width, containerSize.height)]; UIView *container = [[UIView alloc] initWithFrame:CGRectMake(0, 0, containerSize.width, containerSize.height)];
[container css_setUsesFlexbox:YES]; [container css_setUsesFlexbox:YES];
[container css_setFlexDirection:CSSFlexDirectionRow]; [container css_setFlexDirection:YGFlexDirectionRow];
UIView *subview1 = [[UIView alloc] initWithFrame:CGRectZero]; UIView *subview1 = [[UIView alloc] initWithFrame:CGRectZero];
[subview1 css_setUsesFlexbox:YES]; [subview1 css_setUsesFlexbox:YES];
@@ -208,7 +208,7 @@
{ {
UIView *container = [[UIView alloc] initWithFrame:CGRectZero]; UIView *container = [[UIView alloc] initWithFrame:CGRectZero];
[container css_setUsesFlexbox:YES]; [container css_setUsesFlexbox:YES];
[container css_setFlexDirection:CSSFlexDirectionRow]; [container css_setFlexDirection:YGFlexDirectionRow];
UIView *subview1 = [[UIView alloc] initWithFrame:CGRectZero]; UIView *subview1 = [[UIView alloc] initWithFrame:CGRectZero];
[subview1 css_setUsesFlexbox:YES]; [subview1 css_setUsesFlexbox:YES];
@@ -237,7 +237,7 @@
{ {
UIView *container = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 300, 50)]; UIView *container = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 300, 50)];
[container css_setUsesFlexbox:YES]; [container css_setUsesFlexbox:YES];
[container css_setFlexDirection:CSSFlexDirectionRow]; [container css_setFlexDirection:YGFlexDirectionRow];
UIView *subview1 = [[UIView alloc] initWithFrame:CGRectZero]; UIView *subview1 = [[UIView alloc] initWithFrame:CGRectZero];
[subview1 css_setUsesFlexbox:YES]; [subview1 css_setUsesFlexbox:YES];

View File

@@ -22,22 +22,22 @@
*/ */
@property (nonatomic, readwrite, assign, setter=css_setUsesFlexbox:) BOOL css_usesFlexbox; @property (nonatomic, readwrite, assign, setter=css_setUsesFlexbox:) BOOL css_usesFlexbox;
- (void)css_setDirection:(CSSDirection)direction; - (void)css_setDirection:(YGDirection)direction;
- (void)css_setFlexDirection:(CSSFlexDirection)flexDirection; - (void)css_setFlexDirection:(YGFlexDirection)flexDirection;
- (void)css_setJustifyContent:(CSSJustify)justifyContent; - (void)css_setJustifyContent:(YGJustify)justifyContent;
- (void)css_setAlignContent:(CSSAlign)alignContent; - (void)css_setAlignContent:(YGAlign)alignContent;
- (void)css_setAlignItems:(CSSAlign)alignItems; - (void)css_setAlignItems:(YGAlign)alignItems;
- (void)css_setAlignSelf:(CSSAlign)alignSelf; - (void)css_setAlignSelf:(YGAlign)alignSelf;
- (void)css_setPositionType:(CSSPositionType)positionType; - (void)css_setPositionType:(YGPositionType)positionType;
- (void)css_setFlexWrap:(CSSWrap)flexWrap; - (void)css_setFlexWrap:(YGWrap)flexWrap;
- (void)css_setFlexGrow:(CGFloat)flexGrow; - (void)css_setFlexGrow:(CGFloat)flexGrow;
- (void)css_setFlexShrink:(CGFloat)flexShrink; - (void)css_setFlexShrink:(CGFloat)flexShrink;
- (void)css_setFlexBasis:(CGFloat)flexBasis; - (void)css_setFlexBasis:(CGFloat)flexBasis;
- (void)css_setPosition:(CGFloat)position forEdge:(CSSEdge)edge; - (void)css_setPosition:(CGFloat)position forEdge:(YGEdge)edge;
- (void)css_setMargin:(CGFloat)margin forEdge:(CSSEdge)edge; - (void)css_setMargin:(CGFloat)margin forEdge:(YGEdge)edge;
- (void)css_setPadding:(CGFloat)padding forEdge:(CSSEdge)edge; - (void)css_setPadding:(CGFloat)padding forEdge:(YGEdge)edge;
- (void)css_setWidth:(CGFloat)width; - (void)css_setWidth:(CGFloat)width;
- (void)css_setHeight:(CGFloat)height; - (void)css_setHeight:(CGFloat)height;
@@ -50,9 +50,9 @@
- (void)css_setAspectRatio:(CGFloat)aspectRatio; - (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 Perform a layout calculation and update the frames of the views in the hierarchy with th results

View File

@@ -19,7 +19,7 @@
+ (void)initialize + (void)initialize
{ {
CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeatureWebFlexBasis, true); CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeatureWebFlexBasis, true);
} }
- (instancetype)init - (instancetype)init
@@ -76,42 +76,42 @@
OBJC_ASSOCIATION_RETAIN_NONATOMIC); OBJC_ASSOCIATION_RETAIN_NONATOMIC);
} }
- (void)css_setDirection:(CSSDirection)direction - (void)css_setDirection:(YGDirection)direction
{ {
CSSNodeStyleSetDirection([self cssNode], direction); CSSNodeStyleSetDirection([self cssNode], direction);
} }
- (void)css_setFlexDirection:(CSSFlexDirection)flexDirection - (void)css_setFlexDirection:(YGFlexDirection)flexDirection
{ {
CSSNodeStyleSetFlexDirection([self cssNode], flexDirection); CSSNodeStyleSetFlexDirection([self cssNode], flexDirection);
} }
- (void)css_setJustifyContent:(CSSJustify)justifyContent - (void)css_setJustifyContent:(YGJustify)justifyContent
{ {
CSSNodeStyleSetJustifyContent([self cssNode], justifyContent); CSSNodeStyleSetJustifyContent([self cssNode], justifyContent);
} }
- (void)css_setAlignContent:(CSSAlign)alignContent - (void)css_setAlignContent:(YGAlign)alignContent
{ {
CSSNodeStyleSetAlignContent([self cssNode], alignContent); CSSNodeStyleSetAlignContent([self cssNode], alignContent);
} }
- (void)css_setAlignItems:(CSSAlign)alignItems - (void)css_setAlignItems:(YGAlign)alignItems
{ {
CSSNodeStyleSetAlignItems([self cssNode], alignItems); CSSNodeStyleSetAlignItems([self cssNode], alignItems);
} }
- (void)css_setAlignSelf:(CSSAlign)alignSelf - (void)css_setAlignSelf:(YGAlign)alignSelf
{ {
CSSNodeStyleSetAlignSelf([self cssNode], alignSelf); CSSNodeStyleSetAlignSelf([self cssNode], alignSelf);
} }
- (void)css_setPositionType:(CSSPositionType)positionType - (void)css_setPositionType:(YGPositionType)positionType
{ {
CSSNodeStyleSetPositionType([self cssNode], positionType); CSSNodeStyleSetPositionType([self cssNode], positionType);
} }
- (void)css_setFlexWrap:(CSSWrap)flexWrap - (void)css_setFlexWrap:(YGWrap)flexWrap
{ {
CSSNodeStyleSetFlexWrap([self cssNode], flexWrap); CSSNodeStyleSetFlexWrap([self cssNode], flexWrap);
} }
@@ -131,17 +131,17 @@
CSSNodeStyleSetFlexBasis([self cssNode], flexBasis); 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); 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); 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); CSSNodeStyleSetPadding([self cssNode], edge, padding);
} }
@@ -183,7 +183,7 @@
#pragma mark - Layout and Sizing #pragma mark - Layout and Sizing
- (CSSDirection)css_resolvedDirection - (YGDirection)css_resolvedDirection
{ {
return CSSNodeLayoutGetDirection([self cssNode]); return CSSNodeLayoutGetDirection([self cssNode]);
} }
@@ -197,8 +197,8 @@
- (CGSize)css_intrinsicSize - (CGSize)css_intrinsicSize
{ {
const CGSize constrainedSize = { const CGSize constrainedSize = {
.width = CSSUndefined, .width = YGUndefined,
.height = CSSUndefined, .height = YGUndefined,
}; };
return [self calculateLayoutWithSize:constrainedSize]; return [self calculateLayoutWithSize:constrainedSize];
} }
@@ -240,12 +240,12 @@
static CSSSize CSSMeasureView( static CSSSize CSSMeasureView(
CSSNodeRef node, CSSNodeRef node,
float width, float width,
CSSMeasureMode widthMode, YGMeasureMode widthMode,
float height, float height,
CSSMeasureMode heightMode) YGMeasureMode heightMode)
{ {
const CGFloat constrainedWidth = (widthMode == CSSMeasureModeUndefined) ? CGFLOAT_MAX : width; const CGFloat constrainedWidth = (widthMode == YGMeasureModeUndefined) ? CGFLOAT_MAX : width;
const CGFloat constrainedHeight = (heightMode == CSSMeasureModeUndefined) ? CGFLOAT_MAX: height; const CGFloat constrainedHeight = (heightMode == YGMeasureModeUndefined) ? CGFLOAT_MAX: height;
UIView *view = (__bridge UIView*) CSSNodeGetContext(node); UIView *view = (__bridge UIView*) CSSNodeGetContext(node);
const CGSize sizeThatFits = [view sizeThatFits:(CGSize) { const CGSize sizeThatFits = [view sizeThatFits:(CGSize) {
@@ -262,12 +262,12 @@ static CSSSize CSSMeasureView(
static CGFloat CSSSanitizeMeasurement( static CGFloat CSSSanitizeMeasurement(
CGFloat constrainedSize, CGFloat constrainedSize,
CGFloat measuredSize, CGFloat measuredSize,
CSSMeasureMode measureMode) YGMeasureMode measureMode)
{ {
CGFloat result; CGFloat result;
if (measureMode == CSSMeasureModeExactly) { if (measureMode == YGMeasureModeExactly) {
result = constrainedSize; result = constrainedSize;
} else if (measureMode == CSSMeasureModeAtMost) { } else if (measureMode == YGMeasureModeAtMost) {
result = MIN(constrainedSize, measuredSize); result = MIN(constrainedSize, measuredSize);
} else { } else {
result = measuredSize; result = measuredSize;

View File

@@ -61,7 +61,7 @@ for (uint32_t i = 0; i < 10; i++) {
CSSNodeInsertChild(root, child, 0); CSSNodeInsertChild(root, child, 0);
} }
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
// Get for resulting layout // Get for resulting layout
CSSNodeLayoutGetLeft(root); CSSNodeLayoutGetLeft(root);

View File

@@ -13,12 +13,12 @@
static CSSSize _measure(CSSNodeRef node, static CSSSize _measure(CSSNodeRef node,
float width, float width,
CSSMeasureMode widthMode, YGMeasureMode widthMode,
float height, float height,
CSSMeasureMode heightMode) { YGMeasureMode heightMode) {
return (CSSSize){ return (CSSSize){
.width = widthMode == CSSMeasureModeUndefined ? 10 : width, .width = widthMode == YGMeasureModeUndefined ? 10 : width,
.height = heightMode == CSSMeasureModeUndefined ? 10 : width, .height = heightMode == YGMeasureModeUndefined ? 10 : width,
}; };
} }
@@ -36,7 +36,7 @@ CSS_BENCHMARKS({
CSSNodeInsertChild(root, child, 0); CSSNodeInsertChild(root, child, 0);
} }
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
CSSNodeFreeRecursive(root); CSSNodeFreeRecursive(root);
}); });
@@ -50,7 +50,7 @@ CSS_BENCHMARKS({
CSSNodeInsertChild(root, child, 0); CSSNodeInsertChild(root, child, 0);
} }
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
CSSNodeFreeRecursive(root); CSSNodeFreeRecursive(root);
}); });
@@ -70,7 +70,7 @@ CSS_BENCHMARKS({
} }
} }
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
CSSNodeFreeRecursive(root); CSSNodeFreeRecursive(root);
}); });
@@ -86,7 +86,7 @@ CSS_BENCHMARKS({
for (uint32_t ii = 0; ii < 10; ii++) { for (uint32_t ii = 0; ii < 10; ii++) {
const CSSNodeRef grandChild = CSSNodeNew(); const CSSNodeRef grandChild = CSSNodeNew();
CSSNodeStyleSetFlexDirection(grandChild, CSSFlexDirectionRow); CSSNodeStyleSetFlexDirection(grandChild, YGFlexDirectionRow);
CSSNodeStyleSetFlexGrow(grandChild, 1); CSSNodeStyleSetFlexGrow(grandChild, 1);
CSSNodeStyleSetWidth(grandChild, 10); CSSNodeStyleSetWidth(grandChild, 10);
CSSNodeStyleSetHeight(grandChild, 10); CSSNodeStyleSetHeight(grandChild, 10);
@@ -101,7 +101,7 @@ CSS_BENCHMARKS({
for (uint32_t iii = 0; iii < 10; iii++) { for (uint32_t iii = 0; iii < 10; iii++) {
const CSSNodeRef grandGrandGrandChild = CSSNodeNew(); const CSSNodeRef grandGrandGrandChild = CSSNodeNew();
CSSNodeStyleSetFlexDirection(grandGrandGrandChild, CSSFlexDirectionRow); CSSNodeStyleSetFlexDirection(grandGrandGrandChild, YGFlexDirectionRow);
CSSNodeStyleSetFlexGrow(grandGrandGrandChild, 1); CSSNodeStyleSetFlexGrow(grandGrandGrandChild, 1);
CSSNodeStyleSetWidth(grandGrandGrandChild, 10); CSSNodeStyleSetWidth(grandGrandGrandChild, 10);
CSSNodeStyleSetHeight(grandGrandGrandChild, 10); CSSNodeStyleSetHeight(grandGrandGrandChild, 10);
@@ -111,7 +111,7 @@ CSS_BENCHMARKS({
} }
} }
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
CSSNodeFreeRecursive(root); CSSNodeFreeRecursive(root);
}); });

View File

@@ -11,7 +11,7 @@
static CSSInteropLoggerFunc gManagedFunc; 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; int result = 0;
if (gManagedFunc) { if (gManagedFunc) {
char buffer[256]; char buffer[256];

View File

@@ -13,7 +13,7 @@
CSS_EXTERN_C_BEGIN 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); WIN_EXPORT void CSSInteropSetLogger(CSSInteropLoggerFunc managedFunc);

View File

@@ -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,
}
}

View File

@@ -15,7 +15,7 @@ namespace Facebook.CSSLayout
internal static class CSSLogger internal static class CSSLogger
{ {
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] [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 bool _initialized;
private static Func _managedLogger = null; private static Func _managedLogger = null;
@@ -32,7 +32,7 @@ namespace Facebook.CSSLayout
Logger(level, message); Logger(level, message);
} }
if (level == CSSLogLevel.Error) if (level == YogaLogLevel.Error)
{ {
throw new InvalidOperationException(message); throw new InvalidOperationException(message);
} }

View File

@@ -16,7 +16,7 @@ namespace Facebook.CSSLayout
public delegate CSSSize CSSMeasureFunc( public delegate CSSSize CSSMeasureFunc(
IntPtr node, IntPtr node,
float width, float width,
CSSMeasureMode widthMode, YogaMeasureMode widthMode,
float height, float height,
CSSMeasureMode heightMode); YogaMeasureMode heightMode);
} }

View File

@@ -14,15 +14,15 @@ namespace Facebook.CSSLayout
public partial class CSSNode public partial class CSSNode
{ {
public static CSSNode Create( public static CSSNode Create(
CSSDirection? styleDirection = null, YogaDirection? styleDirection = null,
CSSFlexDirection? flexDirection = null, YogaFlexDirection? flexDirection = null,
CSSJustify? justifyContent = null, YogaJustify? justifyContent = null,
CSSAlign? alignContent = null, YogaAlign? alignContent = null,
CSSAlign? alignItems = null, YogaAlign? alignItems = null,
CSSAlign? alignSelf = null, YogaAlign? alignSelf = null,
CSSPositionType? positionType = null, YogaPositionType? positionType = null,
CSSWrap? wrap = null, YogaWrap? wrap = null,
CSSOverflow? overflow = null, YogaOverflow? overflow = null,
float? flex = null, float? flex = null,
float? flexGrow = null, float? flexGrow = null,
float? flexShrink = null, float? flexShrink = null,
@@ -110,22 +110,22 @@ namespace Facebook.CSSLayout
{ {
if (position.Top.HasValue) if (position.Top.HasValue)
{ {
node.SetPosition(CSSEdge.Top, position.Top.Value); node.SetPosition(YogaEdge.Top, position.Top.Value);
} }
if (position.Bottom.HasValue) if (position.Bottom.HasValue)
{ {
node.SetPosition(CSSEdge.Bottom, position.Bottom.Value); node.SetPosition(YogaEdge.Bottom, position.Bottom.Value);
} }
if (position.Left.HasValue) if (position.Left.HasValue)
{ {
node.SetPosition(CSSEdge.Left, position.Left.Value); node.SetPosition(YogaEdge.Left, position.Left.Value);
} }
if (position.Right.HasValue) 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) if (margin.Top.HasValue)
{ {
node.SetMargin(CSSEdge.Top, margin.Top.Value); node.SetMargin(YogaEdge.Top, margin.Top.Value);
} }
if (margin.Bottom.HasValue) if (margin.Bottom.HasValue)
{ {
node.SetMargin(CSSEdge.Bottom, margin.Bottom.Value); node.SetMargin(YogaEdge.Bottom, margin.Bottom.Value);
} }
if (margin.Left.HasValue) if (margin.Left.HasValue)
{ {
node.SetMargin(CSSEdge.Left, margin.Left.Value); node.SetMargin(YogaEdge.Left, margin.Left.Value);
} }
if (margin.Right.HasValue) 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) if (padding.Top.HasValue)
{ {
node.SetPadding(CSSEdge.Top, padding.Top.Value); node.SetPadding(YogaEdge.Top, padding.Top.Value);
} }
if (padding.Bottom.HasValue) if (padding.Bottom.HasValue)
{ {
node.SetPadding(CSSEdge.Bottom, padding.Bottom.Value); node.SetPadding(YogaEdge.Bottom, padding.Bottom.Value);
} }
if (padding.Left.HasValue) if (padding.Left.HasValue)
{ {
node.SetPadding(CSSEdge.Left, padding.Left.Value); node.SetPadding(YogaEdge.Left, padding.Left.Value);
} }
if (padding.Right.HasValue) 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) if (border.Top.HasValue)
{ {
node.SetBorder(CSSEdge.Top, border.Top.Value); node.SetBorder(YogaEdge.Top, border.Top.Value);
} }
if (border.Bottom.HasValue) if (border.Bottom.HasValue)
{ {
node.SetBorder(CSSEdge.Bottom, border.Bottom.Value); node.SetBorder(YogaEdge.Bottom, border.Bottom.Value);
} }
if (border.Left.HasValue) if (border.Left.HasValue)
{ {
node.SetBorder(CSSEdge.Left, border.Left.Value); node.SetBorder(YogaEdge.Left, border.Left.Value);
} }
if (border.Right.HasValue) if (border.Right.HasValue)
{ {
node.SetBorder(CSSEdge.Right, border.Right.Value); node.SetBorder(YogaEdge.Right, border.Right.Value);
} }
} }

View File

@@ -95,7 +95,7 @@ namespace Facebook.CSSLayout
Native.CSSNodeCopyStyle(_cssNode, srcNode._cssNode); Native.CSSNodeCopyStyle(_cssNode, srcNode._cssNode);
} }
public CSSDirection StyleDirection public YogaDirection StyleDirection
{ {
get get
{ {
@@ -108,7 +108,7 @@ namespace Facebook.CSSLayout
} }
} }
public CSSFlexDirection FlexDirection public YogaFlexDirection FlexDirection
{ {
get get
{ {
@@ -121,7 +121,7 @@ namespace Facebook.CSSLayout
} }
} }
public CSSJustify JustifyContent public YogaJustify JustifyContent
{ {
get get
{ {
@@ -134,7 +134,7 @@ namespace Facebook.CSSLayout
} }
} }
public CSSAlign AlignItems public YogaAlign AlignItems
{ {
get get
{ {
@@ -147,7 +147,7 @@ namespace Facebook.CSSLayout
} }
} }
public CSSAlign AlignSelf public YogaAlign AlignSelf
{ {
get get
{ {
@@ -160,7 +160,7 @@ namespace Facebook.CSSLayout
} }
} }
public CSSAlign AlignContent public YogaAlign AlignContent
{ {
get get
{ {
@@ -173,7 +173,7 @@ namespace Facebook.CSSLayout
} }
} }
public CSSPositionType PositionType public YogaPositionType PositionType
{ {
get get
{ {
@@ -186,7 +186,7 @@ namespace Facebook.CSSLayout
} }
} }
public CSSWrap Wrap public YogaWrap Wrap
{ {
get get
{ {
@@ -246,42 +246,42 @@ namespace Facebook.CSSLayout
} }
} }
public float GetMargin(CSSEdge edge) public float GetMargin(YogaEdge edge)
{ {
return Native.CSSNodeStyleGetMargin(_cssNode, 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); Native.CSSNodeStyleSetMargin(_cssNode, edge, value);
} }
public float GetPadding(CSSEdge edge) public float GetPadding(YogaEdge edge)
{ {
return Native.CSSNodeStyleGetPadding(_cssNode, 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); Native.CSSNodeStyleSetPadding(_cssNode, edge, padding);
} }
public float GetBorder(CSSEdge edge) public float GetBorder(YogaEdge edge)
{ {
return Native.CSSNodeStyleGetBorder(_cssNode, 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); Native.CSSNodeStyleSetBorder(_cssNode, edge, border);
} }
public float GetPosition(CSSEdge edge) public float GetPosition(YogaEdge edge)
{ {
return Native.CSSNodeStyleGetPosition(_cssNode, 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); Native.CSSNodeStyleSetPosition(_cssNode, edge, position);
} }
@@ -409,7 +409,7 @@ namespace Facebook.CSSLayout
} }
} }
public CSSDirection LayoutDirection public YogaDirection LayoutDirection
{ {
get get
{ {
@@ -417,7 +417,7 @@ namespace Facebook.CSSLayout
} }
} }
public CSSOverflow Overflow public YogaOverflow Overflow
{ {
get get
{ {
@@ -520,17 +520,17 @@ namespace Facebook.CSSLayout
{ {
Native.CSSNodeCalculateLayout( Native.CSSNodeCalculateLayout(
_cssNode, _cssNode,
CSSConstants.Undefined, YogaConstants.Undefined,
CSSConstants.Undefined, YogaConstants.Undefined,
Native.CSSNodeStyleGetDirection(_cssNode)); Native.CSSNodeStyleGetDirection(_cssNode));
} }
private CSSSize MeasureInternal( private CSSSize MeasureInternal(
IntPtr node, IntPtr node,
float width, float width,
CSSMeasureMode widthMode, YogaMeasureMode widthMode,
float height, float height,
CSSMeasureMode heightMode) YogaMeasureMode heightMode)
{ {
if (_measureFunction == null) if (_measureFunction == null)
{ {
@@ -541,8 +541,8 @@ namespace Facebook.CSSLayout
return new CSSSize { width = MeasureOutput.GetWidth(output), height = MeasureOutput.GetHeight(output) }; return new CSSSize { width = MeasureOutput.GetWidth(output), height = MeasureOutput.GetHeight(output) };
} }
public string Print(CSSPrintOptions options = public string Print(YogaPrintOptions options =
CSSPrintOptions.Layout|CSSPrintOptions.Style|CSSPrintOptions.Children) YogaPrintOptions.Layout|YogaPrintOptions.Style|YogaPrintOptions.Children)
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
CSSLogger.Func orig = CSSLogger.Logger; CSSLogger.Func orig = CSSLogger.Logger;
@@ -570,13 +570,13 @@ namespace Facebook.CSSLayout
} }
public static void SetExperimentalFeatureEnabled( public static void SetExperimentalFeatureEnabled(
CSSExperimentalFeature feature, YogaExperimentalFeature feature,
bool enabled) bool enabled)
{ {
Native.CSSLayoutSetExperimentalFeatureEnabled(feature, enabled); Native.CSSLayoutSetExperimentalFeatureEnabled(feature, enabled);
} }
public static bool IsExperimentalFeatureEnabled(CSSExperimentalFeature feature) public static bool IsExperimentalFeatureEnabled(YogaExperimentalFeature feature)
{ {
return Native.CSSLayoutIsExperimentalFeatureEnabled(feature); return Native.CSSLayoutIsExperimentalFeatureEnabled(feature);
} }

View File

@@ -12,7 +12,7 @@ namespace Facebook.CSSLayout
public delegate long MeasureFunction( public delegate long MeasureFunction(
CSSNode node, CSSNode node,
float width, float width,
CSSMeasureMode widthMode, YogaMeasureMode widthMode,
float height, float height,
CSSMeasureMode heightMode); YogaMeasureMode heightMode);
} }

View File

@@ -41,12 +41,12 @@ namespace Facebook.CSSLayout
[DllImport(DllName)] [DllImport(DllName)]
public static extern void CSSLayoutSetExperimentalFeatureEnabled( public static extern void CSSLayoutSetExperimentalFeatureEnabled(
CSSExperimentalFeature feature, YogaExperimentalFeature feature,
bool enabled); bool enabled);
[DllImport(DllName)] [DllImport(DllName)]
public static extern bool CSSLayoutIsExperimentalFeatureEnabled( public static extern bool CSSLayoutIsExperimentalFeatureEnabled(
CSSExperimentalFeature feature); YogaExperimentalFeature feature);
[DllImport(DllName)] [DllImport(DllName)]
public static extern void CSSNodeInsertChild(IntPtr node, IntPtr child, uint index); 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, public static extern void CSSNodeCalculateLayout(IntPtr node,
float availableWidth, float availableWidth,
float availableHeight, float availableHeight,
CSSDirection parentDirection); YogaDirection parentDirection);
[DllImport(DllName)] [DllImport(DllName)]
public static extern void CSSNodeMarkDirty(IntPtr node); public static extern void CSSNodeMarkDirty(IntPtr node);
@@ -74,7 +74,7 @@ namespace Facebook.CSSLayout
public static extern bool CSSNodeIsDirty(IntPtr node); public static extern bool CSSNodeIsDirty(IntPtr node);
[DllImport(DllName)] [DllImport(DllName)]
public static extern void CSSNodePrint(IntPtr node, CSSPrintOptions options); public static extern void CSSNodePrint(IntPtr node, YogaPrintOptions options);
[DllImport(DllName)] [DllImport(DllName)]
[return: MarshalAs(UnmanagedType.I1)] [return: MarshalAs(UnmanagedType.I1)]
@@ -112,58 +112,58 @@ namespace Facebook.CSSLayout
#region CSS_NODE_STYLE_PROPERTY #region CSS_NODE_STYLE_PROPERTY
[DllImport(DllName)] [DllImport(DllName)]
public static extern void CSSNodeStyleSetDirection(IntPtr node, CSSDirection direction); public static extern void CSSNodeStyleSetDirection(IntPtr node, YogaDirection direction);
[DllImport(DllName)] [DllImport(DllName)]
public static extern CSSDirection CSSNodeStyleGetDirection(IntPtr node); public static extern YogaDirection CSSNodeStyleGetDirection(IntPtr node);
[DllImport(DllName)] [DllImport(DllName)]
public static extern void CSSNodeStyleSetFlexDirection(IntPtr node, CSSFlexDirection flexDirection); public static extern void CSSNodeStyleSetFlexDirection(IntPtr node, YogaFlexDirection flexDirection);
[DllImport(DllName)] [DllImport(DllName)]
public static extern CSSFlexDirection CSSNodeStyleGetFlexDirection(IntPtr node); public static extern YogaFlexDirection CSSNodeStyleGetFlexDirection(IntPtr node);
[DllImport(DllName)] [DllImport(DllName)]
public static extern void CSSNodeStyleSetJustifyContent(IntPtr node, CSSJustify justifyContent); public static extern void CSSNodeStyleSetJustifyContent(IntPtr node, YogaJustify justifyContent);
[DllImport(DllName)] [DllImport(DllName)]
public static extern CSSJustify CSSNodeStyleGetJustifyContent(IntPtr node); public static extern YogaJustify CSSNodeStyleGetJustifyContent(IntPtr node);
[DllImport(DllName)] [DllImport(DllName)]
public static extern void CSSNodeStyleSetAlignContent(IntPtr node, CSSAlign alignContent); public static extern void CSSNodeStyleSetAlignContent(IntPtr node, YogaAlign alignContent);
[DllImport(DllName)] [DllImport(DllName)]
public static extern CSSAlign CSSNodeStyleGetAlignContent(IntPtr node); public static extern YogaAlign CSSNodeStyleGetAlignContent(IntPtr node);
[DllImport(DllName)] [DllImport(DllName)]
public static extern void CSSNodeStyleSetAlignItems(IntPtr node, CSSAlign alignItems); public static extern void CSSNodeStyleSetAlignItems(IntPtr node, YogaAlign alignItems);
[DllImport(DllName)] [DllImport(DllName)]
public static extern CSSAlign CSSNodeStyleGetAlignItems(IntPtr node); public static extern YogaAlign CSSNodeStyleGetAlignItems(IntPtr node);
[DllImport(DllName)] [DllImport(DllName)]
public static extern void CSSNodeStyleSetAlignSelf(IntPtr node, CSSAlign alignSelf); public static extern void CSSNodeStyleSetAlignSelf(IntPtr node, YogaAlign alignSelf);
[DllImport(DllName)] [DllImport(DllName)]
public static extern CSSAlign CSSNodeStyleGetAlignSelf(IntPtr node); public static extern YogaAlign CSSNodeStyleGetAlignSelf(IntPtr node);
[DllImport(DllName)] [DllImport(DllName)]
public static extern void CSSNodeStyleSetPositionType(IntPtr node, CSSPositionType positionType); public static extern void CSSNodeStyleSetPositionType(IntPtr node, YogaPositionType positionType);
[DllImport(DllName)] [DllImport(DllName)]
public static extern CSSPositionType CSSNodeStyleGetPositionType(IntPtr node); public static extern YogaPositionType CSSNodeStyleGetPositionType(IntPtr node);
[DllImport(DllName)] [DllImport(DllName)]
public static extern void CSSNodeStyleSetFlexWrap(IntPtr node, CSSWrap flexWrap); public static extern void CSSNodeStyleSetFlexWrap(IntPtr node, YogaWrap flexWrap);
[DllImport(DllName)] [DllImport(DllName)]
public static extern CSSWrap CSSNodeStyleGetFlexWrap(IntPtr node); public static extern YogaWrap CSSNodeStyleGetFlexWrap(IntPtr node);
[DllImport(DllName)] [DllImport(DllName)]
public static extern void CSSNodeStyleSetOverflow(IntPtr node, CSSOverflow flexWrap); public static extern void CSSNodeStyleSetOverflow(IntPtr node, YogaOverflow flexWrap);
[DllImport(DllName)] [DllImport(DllName)]
public static extern CSSOverflow CSSNodeStyleGetOverflow(IntPtr node); public static extern YogaOverflow CSSNodeStyleGetOverflow(IntPtr node);
[DllImport(DllName)] [DllImport(DllName)]
public static extern void CSSNodeStyleSetFlex(IntPtr node, float flex); public static extern void CSSNodeStyleSetFlex(IntPtr node, float flex);
@@ -233,28 +233,28 @@ namespace Facebook.CSSLayout
#region CSS_NODE_STYLE_EDGE_PROPERTY #region CSS_NODE_STYLE_EDGE_PROPERTY
[DllImport(DllName)] [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)] [DllImport(DllName)]
public static extern float CSSNodeStyleGetPosition(IntPtr node, CSSEdge edge); public static extern float CSSNodeStyleGetPosition(IntPtr node, YogaEdge edge);
[DllImport(DllName)] [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)] [DllImport(DllName)]
public static extern float CSSNodeStyleGetMargin(IntPtr node, CSSEdge edge); public static extern float CSSNodeStyleGetMargin(IntPtr node, YogaEdge edge);
[DllImport(DllName)] [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)] [DllImport(DllName)]
public static extern float CSSNodeStyleGetPadding(IntPtr node, CSSEdge edge); public static extern float CSSNodeStyleGetPadding(IntPtr node, YogaEdge edge);
[DllImport(DllName)] [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)] [DllImport(DllName)]
public static extern float CSSNodeStyleGetBorder(IntPtr node, CSSEdge edge); public static extern float CSSNodeStyleGetBorder(IntPtr node, YogaEdge edge);
#endregion #endregion
@@ -279,7 +279,7 @@ namespace Facebook.CSSLayout
public static extern float CSSNodeLayoutGetHeight(IntPtr node); public static extern float CSSNodeLayoutGetHeight(IntPtr node);
[DllImport(DllName)] [DllImport(DllName)]
public static extern CSSDirection CSSNodeLayoutGetDirection(IntPtr node); public static extern YogaDirection CSSNodeLayoutGetDirection(IntPtr node);
#endregion #endregion
} }

View File

@@ -9,7 +9,7 @@
namespace Facebook.CSSLayout namespace Facebook.CSSLayout
{ {
public enum CSSAlign public enum YogaAlign
{ {
Auto, Auto,
FlexStart, FlexStart,

View File

@@ -9,7 +9,7 @@
namespace Facebook.CSSLayout namespace Facebook.CSSLayout
{ {
public static class CSSConstants public static class YogaConstants
{ {
public const float Undefined = float.NaN; public const float Undefined = float.NaN;

View File

@@ -9,7 +9,7 @@
namespace Facebook.CSSLayout namespace Facebook.CSSLayout
{ {
public enum CSSDimension public enum YogaDimension
{ {
Width, Width,
Height, Height,

View File

@@ -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,
}
}

View File

@@ -9,7 +9,7 @@
namespace Facebook.CSSLayout namespace Facebook.CSSLayout
{ {
public enum CSSEdge public enum YogaEdge
{ {
Left, Left,
Top, Top,

View File

@@ -9,7 +9,7 @@
namespace Facebook.CSSLayout namespace Facebook.CSSLayout
{ {
public enum CSSExperimentalFeature public enum YogaExperimentalFeature
{ {
Rounding, Rounding,
WebFlexBasis, WebFlexBasis,

View File

@@ -9,7 +9,7 @@
namespace Facebook.CSSLayout namespace Facebook.CSSLayout
{ {
public enum CSSFlexDirection public enum YogaFlexDirection
{ {
Column, Column,
ColumnReverse, ColumnReverse,

View File

@@ -9,7 +9,7 @@
namespace Facebook.CSSLayout namespace Facebook.CSSLayout
{ {
public enum CSSJustify public enum YogaJustify
{ {
FlexStart, FlexStart,
Center, Center,

View File

@@ -9,7 +9,7 @@
namespace Facebook.CSSLayout namespace Facebook.CSSLayout
{ {
public enum CSSLogLevel public enum YogaLogLevel
{ {
Error, Error,
Warn, Warn,

View File

@@ -9,7 +9,7 @@
namespace Facebook.CSSLayout namespace Facebook.CSSLayout
{ {
public enum CSSMeasureMode public enum YogaMeasureMode
{ {
Undefined, Undefined,
Exactly, Exactly,

View File

@@ -9,7 +9,7 @@
namespace Facebook.CSSLayout namespace Facebook.CSSLayout
{ {
public enum CSSOverflow public enum YogaOverflow
{ {
Visible, Visible,
Hidden, Hidden,

View File

@@ -9,7 +9,7 @@
namespace Facebook.CSSLayout namespace Facebook.CSSLayout
{ {
public enum CSSPositionType public enum YogaPositionType
{ {
Relative, Relative,
Absolute, Absolute,

View File

@@ -9,7 +9,7 @@
namespace Facebook.CSSLayout namespace Facebook.CSSLayout
{ {
public enum CSSPrintOptions public enum YogaPrintOptions
{ {
Layout = 1, Layout = 1,
Style = 2, Style = 2,

View File

@@ -9,7 +9,7 @@
namespace Facebook.CSSLayout namespace Facebook.CSSLayout
{ {
public enum CSSWrap public enum YogaWrap
{ {
NoWrap, NoWrap,
Wrap, Wrap,

View File

@@ -25,13 +25,13 @@ namespace Facebook.CSSLayout
root.Height = 100f; root.Height = 100f;
CSSNode root_child0 = new CSSNode(); CSSNode root_child0 = new CSSNode();
root_child0.PositionType = CSSPositionType.Absolute; root_child0.PositionType = YogaPositionType.Absolute;
root_child0.SetPosition(CSSEdge.Start, 10f); root_child0.SetPosition(YogaEdge.Start, 10f);
root_child0.SetPosition(CSSEdge.Top, 10f); root_child0.SetPosition(YogaEdge.Top, 10f);
root_child0.Width = 10f; root_child0.Width = 10f;
root_child0.Height = 10f; root_child0.Height = 10f;
root.Insert(0, root_child0); root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -44,7 +44,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(10f, root_child0.LayoutWidth); Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight); Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -66,13 +66,13 @@ namespace Facebook.CSSLayout
root.Height = 100f; root.Height = 100f;
CSSNode root_child0 = new CSSNode(); CSSNode root_child0 = new CSSNode();
root_child0.PositionType = CSSPositionType.Absolute; root_child0.PositionType = YogaPositionType.Absolute;
root_child0.SetPosition(CSSEdge.End, 10f); root_child0.SetPosition(YogaEdge.End, 10f);
root_child0.SetPosition(CSSEdge.Bottom, 10f); root_child0.SetPosition(YogaEdge.Bottom, 10f);
root_child0.Width = 10f; root_child0.Width = 10f;
root_child0.Height = 10f; root_child0.Height = 10f;
root.Insert(0, root_child0); root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -85,7 +85,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(10f, root_child0.LayoutWidth); Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight); Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -107,13 +107,13 @@ namespace Facebook.CSSLayout
root.Height = 100f; root.Height = 100f;
CSSNode root_child0 = new CSSNode(); CSSNode root_child0 = new CSSNode();
root_child0.PositionType = CSSPositionType.Absolute; root_child0.PositionType = YogaPositionType.Absolute;
root_child0.SetPosition(CSSEdge.Start, 10f); root_child0.SetPosition(YogaEdge.Start, 10f);
root_child0.SetPosition(CSSEdge.Top, 10f); root_child0.SetPosition(YogaEdge.Top, 10f);
root_child0.SetPosition(CSSEdge.End, 10f); root_child0.SetPosition(YogaEdge.End, 10f);
root_child0.SetPosition(CSSEdge.Bottom, 10f); root_child0.SetPosition(YogaEdge.Bottom, 10f);
root.Insert(0, root_child0); root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -126,7 +126,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(80f, root_child0.LayoutWidth); Assert.AreEqual(80f, root_child0.LayoutWidth);
Assert.AreEqual(80f, root_child0.LayoutHeight); Assert.AreEqual(80f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -148,15 +148,15 @@ namespace Facebook.CSSLayout
root.Height = 100f; root.Height = 100f;
CSSNode root_child0 = new CSSNode(); CSSNode root_child0 = new CSSNode();
root_child0.PositionType = CSSPositionType.Absolute; root_child0.PositionType = YogaPositionType.Absolute;
root_child0.SetPosition(CSSEdge.Start, 10f); root_child0.SetPosition(YogaEdge.Start, 10f);
root_child0.SetPosition(CSSEdge.Top, 10f); root_child0.SetPosition(YogaEdge.Top, 10f);
root_child0.SetPosition(CSSEdge.End, 10f); root_child0.SetPosition(YogaEdge.End, 10f);
root_child0.SetPosition(CSSEdge.Bottom, 10f); root_child0.SetPosition(YogaEdge.Bottom, 10f);
root_child0.Width = 10f; root_child0.Width = 10f;
root_child0.Height = 10f; root_child0.Height = 10f;
root.Insert(0, root_child0); root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -169,7 +169,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(10f, root_child0.LayoutWidth); Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight); Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); 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() public void Test_do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row; root.FlexDirection = YogaFlexDirection.Row;
root.Overflow = CSSOverflow.Hidden; root.Overflow = YogaOverflow.Hidden;
root.Width = 50f; root.Width = 50f;
root.Height = 50f; root.Height = 50f;
CSSNode root_child0 = new CSSNode(); CSSNode root_child0 = new CSSNode();
root_child0.PositionType = CSSPositionType.Absolute; root_child0.PositionType = YogaPositionType.Absolute;
root_child0.SetPosition(CSSEdge.Start, 0f); root_child0.SetPosition(YogaEdge.Start, 0f);
root_child0.SetPosition(CSSEdge.Top, 0f); root_child0.SetPosition(YogaEdge.Top, 0f);
root.Insert(0, root_child0); root.Insert(0, root_child0);
CSSNode root_child0_child0 = new CSSNode(); CSSNode root_child0_child0 = new CSSNode();
root_child0_child0.Width = 100f; root_child0_child0.Width = 100f;
root_child0_child0.Height = 100f; root_child0_child0.Height = 100f;
root_child0.Insert(0, root_child0_child0); root_child0.Insert(0, root_child0_child0);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); 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.LayoutWidth);
Assert.AreEqual(100f, root_child0_child0.LayoutHeight); Assert.AreEqual(100f, root_child0_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -243,37 +243,37 @@ namespace Facebook.CSSLayout
public void Test_absolute_layout_within_border() public void Test_absolute_layout_within_border()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.SetMargin(CSSEdge.Left, 10f); root.SetMargin(YogaEdge.Left, 10f);
root.SetMargin(CSSEdge.Top, 10f); root.SetMargin(YogaEdge.Top, 10f);
root.SetMargin(CSSEdge.Right, 10f); root.SetMargin(YogaEdge.Right, 10f);
root.SetMargin(CSSEdge.Bottom, 10f); root.SetMargin(YogaEdge.Bottom, 10f);
root.SetPadding(CSSEdge.Left, 10f); root.SetPadding(YogaEdge.Left, 10f);
root.SetPadding(CSSEdge.Top, 10f); root.SetPadding(YogaEdge.Top, 10f);
root.SetPadding(CSSEdge.Right, 10f); root.SetPadding(YogaEdge.Right, 10f);
root.SetPadding(CSSEdge.Bottom, 10f); root.SetPadding(YogaEdge.Bottom, 10f);
root.SetBorder(CSSEdge.Left, 10f); root.SetBorder(YogaEdge.Left, 10f);
root.SetBorder(CSSEdge.Top, 10f); root.SetBorder(YogaEdge.Top, 10f);
root.SetBorder(CSSEdge.Right, 10f); root.SetBorder(YogaEdge.Right, 10f);
root.SetBorder(CSSEdge.Bottom, 10f); root.SetBorder(YogaEdge.Bottom, 10f);
root.Width = 100f; root.Width = 100f;
root.Height = 100f; root.Height = 100f;
CSSNode root_child0 = new CSSNode(); CSSNode root_child0 = new CSSNode();
root_child0.PositionType = CSSPositionType.Absolute; root_child0.PositionType = YogaPositionType.Absolute;
root_child0.SetPosition(CSSEdge.Left, 0f); root_child0.SetPosition(YogaEdge.Left, 0f);
root_child0.SetPosition(CSSEdge.Top, 0f); root_child0.SetPosition(YogaEdge.Top, 0f);
root_child0.Width = 50f; root_child0.Width = 50f;
root_child0.Height = 50f; root_child0.Height = 50f;
root.Insert(0, root_child0); root.Insert(0, root_child0);
CSSNode root_child1 = new CSSNode(); CSSNode root_child1 = new CSSNode();
root_child1.PositionType = CSSPositionType.Absolute; root_child1.PositionType = YogaPositionType.Absolute;
root_child1.SetPosition(CSSEdge.Right, 0f); root_child1.SetPosition(YogaEdge.Right, 0f);
root_child1.SetPosition(CSSEdge.Bottom, 0f); root_child1.SetPosition(YogaEdge.Bottom, 0f);
root_child1.Width = 50f; root_child1.Width = 50f;
root_child1.Height = 50f; root_child1.Height = 50f;
root.Insert(1, root_child1); root.Insert(1, root_child1);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(10f, root.LayoutX); Assert.AreEqual(10f, root.LayoutX);
@@ -291,7 +291,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(50f, root_child1.LayoutWidth); Assert.AreEqual(50f, root_child1.LayoutWidth);
Assert.AreEqual(50f, root_child1.LayoutHeight); Assert.AreEqual(50f, root_child1.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(10f, root.LayoutX); Assert.AreEqual(10f, root.LayoutX);

View File

@@ -21,7 +21,7 @@ namespace Facebook.CSSLayout
public void Test_align_content_flex_start() public void Test_align_content_flex_start()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.Wrap = CSSWrap.Wrap; root.Wrap = YogaWrap.Wrap;
root.Width = 100f; root.Width = 100f;
root.Height = 100f; root.Height = 100f;
@@ -49,7 +49,7 @@ namespace Facebook.CSSLayout
root_child4.Width = 50f; root_child4.Width = 50f;
root_child4.Height = 10f; root_child4.Height = 10f;
root.Insert(4, root_child4); root.Insert(4, root_child4);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -82,7 +82,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(50f, root_child4.LayoutWidth); Assert.AreEqual(50f, root_child4.LayoutWidth);
Assert.AreEqual(10f, root_child4.LayoutHeight); Assert.AreEqual(10f, root_child4.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -120,8 +120,8 @@ namespace Facebook.CSSLayout
public void Test_align_content_flex_end() public void Test_align_content_flex_end()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.AlignContent = CSSAlign.FlexEnd; root.AlignContent = YogaAlign.FlexEnd;
root.Wrap = CSSWrap.Wrap; root.Wrap = YogaWrap.Wrap;
root.Width = 100f; root.Width = 100f;
root.Height = 100f; root.Height = 100f;
@@ -149,7 +149,7 @@ namespace Facebook.CSSLayout
root_child4.Width = 50f; root_child4.Width = 50f;
root_child4.Height = 10f; root_child4.Height = 10f;
root.Insert(4, root_child4); root.Insert(4, root_child4);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -182,7 +182,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(50f, root_child4.LayoutWidth); Assert.AreEqual(50f, root_child4.LayoutWidth);
Assert.AreEqual(10f, root_child4.LayoutHeight); Assert.AreEqual(10f, root_child4.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -220,8 +220,8 @@ namespace Facebook.CSSLayout
public void Test_align_content_center() public void Test_align_content_center()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.AlignContent = CSSAlign.Center; root.AlignContent = YogaAlign.Center;
root.Wrap = CSSWrap.Wrap; root.Wrap = YogaWrap.Wrap;
root.Width = 100f; root.Width = 100f;
root.Height = 100f; root.Height = 100f;
@@ -249,7 +249,7 @@ namespace Facebook.CSSLayout
root_child4.Width = 50f; root_child4.Width = 50f;
root_child4.Height = 10f; root_child4.Height = 10f;
root.Insert(4, root_child4); root.Insert(4, root_child4);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -282,7 +282,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(50f, root_child4.LayoutWidth); Assert.AreEqual(50f, root_child4.LayoutWidth);
Assert.AreEqual(10f, root_child4.LayoutHeight); Assert.AreEqual(10f, root_child4.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -320,8 +320,8 @@ namespace Facebook.CSSLayout
public void Test_align_content_stretch() public void Test_align_content_stretch()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.AlignContent = CSSAlign.Stretch; root.AlignContent = YogaAlign.Stretch;
root.Wrap = CSSWrap.Wrap; root.Wrap = YogaWrap.Wrap;
root.Width = 100f; root.Width = 100f;
root.Height = 100f; root.Height = 100f;
@@ -344,7 +344,7 @@ namespace Facebook.CSSLayout
CSSNode root_child4 = new CSSNode(); CSSNode root_child4 = new CSSNode();
root_child4.Width = 50f; root_child4.Width = 50f;
root.Insert(4, root_child4); root.Insert(4, root_child4);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -377,7 +377,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(50f, root_child4.LayoutWidth); Assert.AreEqual(50f, root_child4.LayoutWidth);
Assert.AreEqual(0f, root_child4.LayoutHeight); Assert.AreEqual(0f, root_child4.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);

View File

@@ -27,7 +27,7 @@ namespace Facebook.CSSLayout
CSSNode root_child0 = new CSSNode(); CSSNode root_child0 = new CSSNode();
root_child0.Height = 10f; root_child0.Height = 10f;
root.Insert(0, root_child0); root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -40,7 +40,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(100f, root_child0.LayoutWidth); Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight); Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -58,7 +58,7 @@ namespace Facebook.CSSLayout
public void Test_align_items_center() public void Test_align_items_center()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.AlignItems = CSSAlign.Center; root.AlignItems = YogaAlign.Center;
root.Width = 100f; root.Width = 100f;
root.Height = 100f; root.Height = 100f;
@@ -66,7 +66,7 @@ namespace Facebook.CSSLayout
root_child0.Width = 10f; root_child0.Width = 10f;
root_child0.Height = 10f; root_child0.Height = 10f;
root.Insert(0, root_child0); root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -79,7 +79,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(10f, root_child0.LayoutWidth); Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight); Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -97,7 +97,7 @@ namespace Facebook.CSSLayout
public void Test_align_items_flex_start() public void Test_align_items_flex_start()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.AlignItems = CSSAlign.FlexStart; root.AlignItems = YogaAlign.FlexStart;
root.Width = 100f; root.Width = 100f;
root.Height = 100f; root.Height = 100f;
@@ -105,7 +105,7 @@ namespace Facebook.CSSLayout
root_child0.Width = 10f; root_child0.Width = 10f;
root_child0.Height = 10f; root_child0.Height = 10f;
root.Insert(0, root_child0); root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -118,7 +118,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(10f, root_child0.LayoutWidth); Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight); Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -136,7 +136,7 @@ namespace Facebook.CSSLayout
public void Test_align_items_flex_end() public void Test_align_items_flex_end()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.AlignItems = CSSAlign.FlexEnd; root.AlignItems = YogaAlign.FlexEnd;
root.Width = 100f; root.Width = 100f;
root.Height = 100f; root.Height = 100f;
@@ -144,7 +144,7 @@ namespace Facebook.CSSLayout
root_child0.Width = 10f; root_child0.Width = 10f;
root_child0.Height = 10f; root_child0.Height = 10f;
root.Insert(0, root_child0); root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -157,7 +157,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(10f, root_child0.LayoutWidth); Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight); Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);

View File

@@ -25,11 +25,11 @@ namespace Facebook.CSSLayout
root.Height = 100f; root.Height = 100f;
CSSNode root_child0 = new CSSNode(); CSSNode root_child0 = new CSSNode();
root_child0.AlignSelf = CSSAlign.Center; root_child0.AlignSelf = YogaAlign.Center;
root_child0.Width = 10f; root_child0.Width = 10f;
root_child0.Height = 10f; root_child0.Height = 10f;
root.Insert(0, root_child0); root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -42,7 +42,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(10f, root_child0.LayoutWidth); Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight); Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -64,11 +64,11 @@ namespace Facebook.CSSLayout
root.Height = 100f; root.Height = 100f;
CSSNode root_child0 = new CSSNode(); CSSNode root_child0 = new CSSNode();
root_child0.AlignSelf = CSSAlign.FlexEnd; root_child0.AlignSelf = YogaAlign.FlexEnd;
root_child0.Width = 10f; root_child0.Width = 10f;
root_child0.Height = 10f; root_child0.Height = 10f;
root.Insert(0, root_child0); root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -81,7 +81,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(10f, root_child0.LayoutWidth); Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight); Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -103,11 +103,11 @@ namespace Facebook.CSSLayout
root.Height = 100f; root.Height = 100f;
CSSNode root_child0 = new CSSNode(); CSSNode root_child0 = new CSSNode();
root_child0.AlignSelf = CSSAlign.FlexStart; root_child0.AlignSelf = YogaAlign.FlexStart;
root_child0.Width = 10f; root_child0.Width = 10f;
root_child0.Height = 10f; root_child0.Height = 10f;
root.Insert(0, root_child0); root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -120,7 +120,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(10f, root_child0.LayoutWidth); Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight); Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -138,16 +138,16 @@ namespace Facebook.CSSLayout
public void Test_align_self_flex_end_override_flex_start() public void Test_align_self_flex_end_override_flex_start()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.AlignItems = CSSAlign.FlexStart; root.AlignItems = YogaAlign.FlexStart;
root.Width = 100f; root.Width = 100f;
root.Height = 100f; root.Height = 100f;
CSSNode root_child0 = new CSSNode(); CSSNode root_child0 = new CSSNode();
root_child0.AlignSelf = CSSAlign.FlexEnd; root_child0.AlignSelf = YogaAlign.FlexEnd;
root_child0.Width = 10f; root_child0.Width = 10f;
root_child0.Height = 10f; root_child0.Height = 10f;
root.Insert(0, root_child0); root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -160,7 +160,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(10f, root_child0.LayoutWidth); Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight); Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);

View File

@@ -21,11 +21,11 @@ namespace Facebook.CSSLayout
public void Test_border_no_size() public void Test_border_no_size()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.SetBorder(CSSEdge.Left, 10f); root.SetBorder(YogaEdge.Left, 10f);
root.SetBorder(CSSEdge.Top, 10f); root.SetBorder(YogaEdge.Top, 10f);
root.SetBorder(CSSEdge.Right, 10f); root.SetBorder(YogaEdge.Right, 10f);
root.SetBorder(CSSEdge.Bottom, 10f); root.SetBorder(YogaEdge.Bottom, 10f);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -33,7 +33,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(20f, root.LayoutWidth); Assert.AreEqual(20f, root.LayoutWidth);
Assert.AreEqual(20f, root.LayoutHeight); Assert.AreEqual(20f, root.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -46,16 +46,16 @@ namespace Facebook.CSSLayout
public void Test_border_container_match_child() public void Test_border_container_match_child()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.SetBorder(CSSEdge.Left, 10f); root.SetBorder(YogaEdge.Left, 10f);
root.SetBorder(CSSEdge.Top, 10f); root.SetBorder(YogaEdge.Top, 10f);
root.SetBorder(CSSEdge.Right, 10f); root.SetBorder(YogaEdge.Right, 10f);
root.SetBorder(CSSEdge.Bottom, 10f); root.SetBorder(YogaEdge.Bottom, 10f);
CSSNode root_child0 = new CSSNode(); CSSNode root_child0 = new CSSNode();
root_child0.Width = 10f; root_child0.Width = 10f;
root_child0.Height = 10f; root_child0.Height = 10f;
root.Insert(0, root_child0); root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -68,7 +68,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(10f, root_child0.LayoutWidth); Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight); Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -86,10 +86,10 @@ namespace Facebook.CSSLayout
public void Test_border_flex_child() public void Test_border_flex_child()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.SetBorder(CSSEdge.Left, 10f); root.SetBorder(YogaEdge.Left, 10f);
root.SetBorder(CSSEdge.Top, 10f); root.SetBorder(YogaEdge.Top, 10f);
root.SetBorder(CSSEdge.Right, 10f); root.SetBorder(YogaEdge.Right, 10f);
root.SetBorder(CSSEdge.Bottom, 10f); root.SetBorder(YogaEdge.Bottom, 10f);
root.Width = 100f; root.Width = 100f;
root.Height = 100f; root.Height = 100f;
@@ -97,7 +97,7 @@ namespace Facebook.CSSLayout
root_child0.FlexGrow = 1f; root_child0.FlexGrow = 1f;
root_child0.Width = 10f; root_child0.Width = 10f;
root.Insert(0, root_child0); root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -110,7 +110,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(10f, root_child0.LayoutWidth); Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(80f, root_child0.LayoutHeight); Assert.AreEqual(80f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -128,17 +128,17 @@ namespace Facebook.CSSLayout
public void Test_border_stretch_child() public void Test_border_stretch_child()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.SetBorder(CSSEdge.Left, 10f); root.SetBorder(YogaEdge.Left, 10f);
root.SetBorder(CSSEdge.Top, 10f); root.SetBorder(YogaEdge.Top, 10f);
root.SetBorder(CSSEdge.Right, 10f); root.SetBorder(YogaEdge.Right, 10f);
root.SetBorder(CSSEdge.Bottom, 10f); root.SetBorder(YogaEdge.Bottom, 10f);
root.Width = 100f; root.Width = 100f;
root.Height = 100f; root.Height = 100f;
CSSNode root_child0 = new CSSNode(); CSSNode root_child0 = new CSSNode();
root_child0.Height = 10f; root_child0.Height = 10f;
root.Insert(0, root_child0); root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -151,7 +151,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(80f, root_child0.LayoutWidth); Assert.AreEqual(80f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight); Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -169,11 +169,11 @@ namespace Facebook.CSSLayout
public void Test_border_center_child() public void Test_border_center_child()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.JustifyContent = CSSJustify.Center; root.JustifyContent = YogaJustify.Center;
root.AlignItems = CSSAlign.Center; root.AlignItems = YogaAlign.Center;
root.SetBorder(CSSEdge.Start, 10f); root.SetBorder(YogaEdge.Start, 10f);
root.SetBorder(CSSEdge.End, 20f); root.SetBorder(YogaEdge.End, 20f);
root.SetBorder(CSSEdge.Bottom, 20f); root.SetBorder(YogaEdge.Bottom, 20f);
root.Width = 100f; root.Width = 100f;
root.Height = 100f; root.Height = 100f;
@@ -181,7 +181,7 @@ namespace Facebook.CSSLayout
root_child0.Width = 10f; root_child0.Width = 10f;
root_child0.Height = 10f; root_child0.Height = 10f;
root.Insert(0, root_child0); root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -194,7 +194,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(10f, root_child0.LayoutWidth); Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight); Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);

View File

@@ -34,7 +34,7 @@ namespace Facebook.CSSLayout
CSSNode root_child2 = new CSSNode(); CSSNode root_child2 = new CSSNode();
root_child2.Height = 10f; root_child2.Height = 10f;
root.Insert(2, root_child2); root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -57,7 +57,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(100f, root_child2.LayoutWidth); Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(10f, root_child2.LayoutHeight); Assert.AreEqual(10f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -85,7 +85,7 @@ namespace Facebook.CSSLayout
public void Test_flex_direction_row_no_width() public void Test_flex_direction_row_no_width()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row; root.FlexDirection = YogaFlexDirection.Row;
root.Height = 100f; root.Height = 100f;
CSSNode root_child0 = new CSSNode(); CSSNode root_child0 = new CSSNode();
@@ -99,7 +99,7 @@ namespace Facebook.CSSLayout
CSSNode root_child2 = new CSSNode(); CSSNode root_child2 = new CSSNode();
root_child2.Width = 10f; root_child2.Width = 10f;
root.Insert(2, root_child2); root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -122,7 +122,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(10f, root_child2.LayoutWidth); Assert.AreEqual(10f, root_child2.LayoutWidth);
Assert.AreEqual(100f, root_child2.LayoutHeight); Assert.AreEqual(100f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -164,7 +164,7 @@ namespace Facebook.CSSLayout
CSSNode root_child2 = new CSSNode(); CSSNode root_child2 = new CSSNode();
root_child2.Height = 10f; root_child2.Height = 10f;
root.Insert(2, root_child2); root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -187,7 +187,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(100f, root_child2.LayoutWidth); Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(10f, root_child2.LayoutHeight); Assert.AreEqual(10f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -215,7 +215,7 @@ namespace Facebook.CSSLayout
public void Test_flex_direction_row() public void Test_flex_direction_row()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row; root.FlexDirection = YogaFlexDirection.Row;
root.Width = 100f; root.Width = 100f;
root.Height = 100f; root.Height = 100f;
@@ -230,7 +230,7 @@ namespace Facebook.CSSLayout
CSSNode root_child2 = new CSSNode(); CSSNode root_child2 = new CSSNode();
root_child2.Width = 10f; root_child2.Width = 10f;
root.Insert(2, root_child2); root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -253,7 +253,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(10f, root_child2.LayoutWidth); Assert.AreEqual(10f, root_child2.LayoutWidth);
Assert.AreEqual(100f, root_child2.LayoutHeight); Assert.AreEqual(100f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -281,7 +281,7 @@ namespace Facebook.CSSLayout
public void Test_flex_direction_column_reverse() public void Test_flex_direction_column_reverse()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.ColumnReverse; root.FlexDirection = YogaFlexDirection.ColumnReverse;
root.Width = 100f; root.Width = 100f;
root.Height = 100f; root.Height = 100f;
@@ -296,7 +296,7 @@ namespace Facebook.CSSLayout
CSSNode root_child2 = new CSSNode(); CSSNode root_child2 = new CSSNode();
root_child2.Height = 10f; root_child2.Height = 10f;
root.Insert(2, root_child2); root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -319,7 +319,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(100f, root_child2.LayoutWidth); Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(10f, root_child2.LayoutHeight); Assert.AreEqual(10f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -347,7 +347,7 @@ namespace Facebook.CSSLayout
public void Test_flex_direction_row_reverse() public void Test_flex_direction_row_reverse()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.RowReverse; root.FlexDirection = YogaFlexDirection.RowReverse;
root.Width = 100f; root.Width = 100f;
root.Height = 100f; root.Height = 100f;
@@ -362,7 +362,7 @@ namespace Facebook.CSSLayout
CSSNode root_child2 = new CSSNode(); CSSNode root_child2 = new CSSNode();
root_child2.Width = 10f; root_child2.Width = 10f;
root.Insert(2, root_child2); root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -385,7 +385,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(10f, root_child2.LayoutWidth); Assert.AreEqual(10f, root_child2.LayoutWidth);
Assert.AreEqual(100f, root_child2.LayoutHeight); Assert.AreEqual(100f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);

View File

@@ -32,7 +32,7 @@ namespace Facebook.CSSLayout
CSSNode root_child1 = new CSSNode(); CSSNode root_child1 = new CSSNode();
root_child1.FlexGrow = 1f; root_child1.FlexGrow = 1f;
root.Insert(1, root_child1); root.Insert(1, root_child1);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -50,7 +50,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(100f, root_child1.LayoutWidth); Assert.AreEqual(100f, root_child1.LayoutWidth);
Assert.AreEqual(25f, root_child1.LayoutHeight); Assert.AreEqual(25f, root_child1.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -73,7 +73,7 @@ namespace Facebook.CSSLayout
public void Test_flex_basis_flex_grow_row() public void Test_flex_basis_flex_grow_row()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row; root.FlexDirection = YogaFlexDirection.Row;
root.Width = 100f; root.Width = 100f;
root.Height = 100f; root.Height = 100f;
@@ -85,7 +85,7 @@ namespace Facebook.CSSLayout
CSSNode root_child1 = new CSSNode(); CSSNode root_child1 = new CSSNode();
root_child1.FlexGrow = 1f; root_child1.FlexGrow = 1f;
root.Insert(1, root_child1); root.Insert(1, root_child1);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -103,7 +103,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(25f, root_child1.LayoutWidth); Assert.AreEqual(25f, root_child1.LayoutWidth);
Assert.AreEqual(100f, root_child1.LayoutHeight); Assert.AreEqual(100f, root_child1.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -137,7 +137,7 @@ namespace Facebook.CSSLayout
CSSNode root_child1 = new CSSNode(); CSSNode root_child1 = new CSSNode();
root_child1.FlexBasis = 50f; root_child1.FlexBasis = 50f;
root.Insert(1, root_child1); root.Insert(1, root_child1);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -155,7 +155,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(100f, root_child1.LayoutWidth); Assert.AreEqual(100f, root_child1.LayoutWidth);
Assert.AreEqual(50f, root_child1.LayoutHeight); Assert.AreEqual(50f, root_child1.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -178,7 +178,7 @@ namespace Facebook.CSSLayout
public void Test_flex_basis_flex_shrink_row() public void Test_flex_basis_flex_shrink_row()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row; root.FlexDirection = YogaFlexDirection.Row;
root.Width = 100f; root.Width = 100f;
root.Height = 100f; root.Height = 100f;
@@ -190,7 +190,7 @@ namespace Facebook.CSSLayout
CSSNode root_child1 = new CSSNode(); CSSNode root_child1 = new CSSNode();
root_child1.FlexBasis = 50f; root_child1.FlexBasis = 50f;
root.Insert(1, root_child1); root.Insert(1, root_child1);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -208,7 +208,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(50f, root_child1.LayoutWidth); Assert.AreEqual(50f, root_child1.LayoutWidth);
Assert.AreEqual(100f, root_child1.LayoutHeight); Assert.AreEqual(100f, root_child1.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -248,7 +248,7 @@ namespace Facebook.CSSLayout
root_child2.Width = 50f; root_child2.Width = 50f;
root_child2.Height = 50f; root_child2.Height = 50f;
root.Insert(2, root_child2); root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -271,7 +271,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(50f, root_child2.LayoutWidth); Assert.AreEqual(50f, root_child2.LayoutWidth);
Assert.AreEqual(50f, root_child2.LayoutHeight); Assert.AreEqual(50f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -317,7 +317,7 @@ namespace Facebook.CSSLayout
root_child2.FlexGrow = 1f; root_child2.FlexGrow = 1f;
root_child2.Height = 10f; root_child2.Height = 10f;
root.Insert(2, root_child2); root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -340,7 +340,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(100f, root_child2.LayoutWidth); Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(20f, root_child2.LayoutHeight); Assert.AreEqual(20f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -378,7 +378,7 @@ namespace Facebook.CSSLayout
root_child0_child0.FlexGrow = 1f; root_child0_child0.FlexGrow = 1f;
root_child0_child0.FlexShrink = 1f; root_child0_child0.FlexShrink = 1f;
root_child0.Insert(0, root_child0_child0); root_child0.Insert(0, root_child0_child0);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -396,7 +396,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(100f, root_child0_child0.LayoutWidth); Assert.AreEqual(100f, root_child0_child0.LayoutWidth);
Assert.AreEqual(0f, root_child0_child0.LayoutHeight); Assert.AreEqual(0f, root_child0_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);

View File

@@ -21,7 +21,7 @@ namespace Facebook.CSSLayout
public void Test_wrap_column() public void Test_wrap_column()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.Wrap = CSSWrap.Wrap; root.Wrap = YogaWrap.Wrap;
root.Height = 100f; root.Height = 100f;
CSSNode root_child0 = new CSSNode(); CSSNode root_child0 = new CSSNode();
@@ -43,7 +43,7 @@ namespace Facebook.CSSLayout
root_child3.Width = 30f; root_child3.Width = 30f;
root_child3.Height = 30f; root_child3.Height = 30f;
root.Insert(3, root_child3); root.Insert(3, root_child3);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -71,7 +71,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(30f, root_child3.LayoutWidth); Assert.AreEqual(30f, root_child3.LayoutWidth);
Assert.AreEqual(30f, root_child3.LayoutHeight); Assert.AreEqual(30f, root_child3.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -104,8 +104,8 @@ namespace Facebook.CSSLayout
public void Test_wrap_row() public void Test_wrap_row()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row; root.FlexDirection = YogaFlexDirection.Row;
root.Wrap = CSSWrap.Wrap; root.Wrap = YogaWrap.Wrap;
root.Width = 100f; root.Width = 100f;
CSSNode root_child0 = new CSSNode(); CSSNode root_child0 = new CSSNode();
@@ -127,7 +127,7 @@ namespace Facebook.CSSLayout
root_child3.Width = 30f; root_child3.Width = 30f;
root_child3.Height = 30f; root_child3.Height = 30f;
root.Insert(3, root_child3); root.Insert(3, root_child3);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -155,7 +155,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(30f, root_child3.LayoutWidth); Assert.AreEqual(30f, root_child3.LayoutWidth);
Assert.AreEqual(30f, root_child3.LayoutHeight); Assert.AreEqual(30f, root_child3.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -188,9 +188,9 @@ namespace Facebook.CSSLayout
public void Test_wrap_row_align_items_flex_end() public void Test_wrap_row_align_items_flex_end()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row; root.FlexDirection = YogaFlexDirection.Row;
root.AlignItems = CSSAlign.FlexEnd; root.AlignItems = YogaAlign.FlexEnd;
root.Wrap = CSSWrap.Wrap; root.Wrap = YogaWrap.Wrap;
root.Width = 100f; root.Width = 100f;
CSSNode root_child0 = new CSSNode(); CSSNode root_child0 = new CSSNode();
@@ -212,7 +212,7 @@ namespace Facebook.CSSLayout
root_child3.Width = 30f; root_child3.Width = 30f;
root_child3.Height = 30f; root_child3.Height = 30f;
root.Insert(3, root_child3); root.Insert(3, root_child3);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -240,7 +240,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(30f, root_child3.LayoutWidth); Assert.AreEqual(30f, root_child3.LayoutWidth);
Assert.AreEqual(30f, root_child3.LayoutHeight); Assert.AreEqual(30f, root_child3.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -273,9 +273,9 @@ namespace Facebook.CSSLayout
public void Test_wrap_row_align_items_center() public void Test_wrap_row_align_items_center()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row; root.FlexDirection = YogaFlexDirection.Row;
root.AlignItems = CSSAlign.Center; root.AlignItems = YogaAlign.Center;
root.Wrap = CSSWrap.Wrap; root.Wrap = YogaWrap.Wrap;
root.Width = 100f; root.Width = 100f;
CSSNode root_child0 = new CSSNode(); CSSNode root_child0 = new CSSNode();
@@ -297,7 +297,7 @@ namespace Facebook.CSSLayout
root_child3.Width = 30f; root_child3.Width = 30f;
root_child3.Height = 30f; root_child3.Height = 30f;
root.Insert(3, root_child3); root.Insert(3, root_child3);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -325,7 +325,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(30f, root_child3.LayoutWidth); Assert.AreEqual(30f, root_child3.LayoutWidth);
Assert.AreEqual(30f, root_child3.LayoutHeight); Assert.AreEqual(30f, root_child3.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);

View File

@@ -21,7 +21,7 @@ namespace Facebook.CSSLayout
public void Test_justify_content_row_flex_start() public void Test_justify_content_row_flex_start()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row; root.FlexDirection = YogaFlexDirection.Row;
root.Width = 102f; root.Width = 102f;
root.Height = 102f; root.Height = 102f;
@@ -36,7 +36,7 @@ namespace Facebook.CSSLayout
CSSNode root_child2 = new CSSNode(); CSSNode root_child2 = new CSSNode();
root_child2.Width = 10f; root_child2.Width = 10f;
root.Insert(2, root_child2); root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -59,7 +59,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(10f, root_child2.LayoutWidth); Assert.AreEqual(10f, root_child2.LayoutWidth);
Assert.AreEqual(102f, root_child2.LayoutHeight); Assert.AreEqual(102f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -87,8 +87,8 @@ namespace Facebook.CSSLayout
public void Test_justify_content_row_flex_end() public void Test_justify_content_row_flex_end()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row; root.FlexDirection = YogaFlexDirection.Row;
root.JustifyContent = CSSJustify.FlexEnd; root.JustifyContent = YogaJustify.FlexEnd;
root.Width = 102f; root.Width = 102f;
root.Height = 102f; root.Height = 102f;
@@ -103,7 +103,7 @@ namespace Facebook.CSSLayout
CSSNode root_child2 = new CSSNode(); CSSNode root_child2 = new CSSNode();
root_child2.Width = 10f; root_child2.Width = 10f;
root.Insert(2, root_child2); root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -126,7 +126,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(10f, root_child2.LayoutWidth); Assert.AreEqual(10f, root_child2.LayoutWidth);
Assert.AreEqual(102f, root_child2.LayoutHeight); Assert.AreEqual(102f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -154,8 +154,8 @@ namespace Facebook.CSSLayout
public void Test_justify_content_row_center() public void Test_justify_content_row_center()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row; root.FlexDirection = YogaFlexDirection.Row;
root.JustifyContent = CSSJustify.Center; root.JustifyContent = YogaJustify.Center;
root.Width = 102f; root.Width = 102f;
root.Height = 102f; root.Height = 102f;
@@ -170,7 +170,7 @@ namespace Facebook.CSSLayout
CSSNode root_child2 = new CSSNode(); CSSNode root_child2 = new CSSNode();
root_child2.Width = 10f; root_child2.Width = 10f;
root.Insert(2, root_child2); root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -193,7 +193,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(10f, root_child2.LayoutWidth); Assert.AreEqual(10f, root_child2.LayoutWidth);
Assert.AreEqual(102f, root_child2.LayoutHeight); Assert.AreEqual(102f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -221,8 +221,8 @@ namespace Facebook.CSSLayout
public void Test_justify_content_row_space_between() public void Test_justify_content_row_space_between()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row; root.FlexDirection = YogaFlexDirection.Row;
root.JustifyContent = CSSJustify.SpaceBetween; root.JustifyContent = YogaJustify.SpaceBetween;
root.Width = 102f; root.Width = 102f;
root.Height = 102f; root.Height = 102f;
@@ -237,7 +237,7 @@ namespace Facebook.CSSLayout
CSSNode root_child2 = new CSSNode(); CSSNode root_child2 = new CSSNode();
root_child2.Width = 10f; root_child2.Width = 10f;
root.Insert(2, root_child2); root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -260,7 +260,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(10f, root_child2.LayoutWidth); Assert.AreEqual(10f, root_child2.LayoutWidth);
Assert.AreEqual(102f, root_child2.LayoutHeight); Assert.AreEqual(102f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -288,8 +288,8 @@ namespace Facebook.CSSLayout
public void Test_justify_content_row_space_around() public void Test_justify_content_row_space_around()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row; root.FlexDirection = YogaFlexDirection.Row;
root.JustifyContent = CSSJustify.SpaceAround; root.JustifyContent = YogaJustify.SpaceAround;
root.Width = 102f; root.Width = 102f;
root.Height = 102f; root.Height = 102f;
@@ -304,7 +304,7 @@ namespace Facebook.CSSLayout
CSSNode root_child2 = new CSSNode(); CSSNode root_child2 = new CSSNode();
root_child2.Width = 10f; root_child2.Width = 10f;
root.Insert(2, root_child2); root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -327,7 +327,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(10f, root_child2.LayoutWidth); Assert.AreEqual(10f, root_child2.LayoutWidth);
Assert.AreEqual(102f, root_child2.LayoutHeight); Assert.AreEqual(102f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -368,7 +368,7 @@ namespace Facebook.CSSLayout
CSSNode root_child2 = new CSSNode(); CSSNode root_child2 = new CSSNode();
root_child2.Height = 10f; root_child2.Height = 10f;
root.Insert(2, root_child2); root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -391,7 +391,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(102f, root_child2.LayoutWidth); Assert.AreEqual(102f, root_child2.LayoutWidth);
Assert.AreEqual(10f, root_child2.LayoutHeight); Assert.AreEqual(10f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -419,7 +419,7 @@ namespace Facebook.CSSLayout
public void Test_justify_content_column_flex_end() public void Test_justify_content_column_flex_end()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.JustifyContent = CSSJustify.FlexEnd; root.JustifyContent = YogaJustify.FlexEnd;
root.Width = 102f; root.Width = 102f;
root.Height = 102f; root.Height = 102f;
@@ -434,7 +434,7 @@ namespace Facebook.CSSLayout
CSSNode root_child2 = new CSSNode(); CSSNode root_child2 = new CSSNode();
root_child2.Height = 10f; root_child2.Height = 10f;
root.Insert(2, root_child2); root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -457,7 +457,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(102f, root_child2.LayoutWidth); Assert.AreEqual(102f, root_child2.LayoutWidth);
Assert.AreEqual(10f, root_child2.LayoutHeight); Assert.AreEqual(10f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -485,7 +485,7 @@ namespace Facebook.CSSLayout
public void Test_justify_content_column_center() public void Test_justify_content_column_center()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.JustifyContent = CSSJustify.Center; root.JustifyContent = YogaJustify.Center;
root.Width = 102f; root.Width = 102f;
root.Height = 102f; root.Height = 102f;
@@ -500,7 +500,7 @@ namespace Facebook.CSSLayout
CSSNode root_child2 = new CSSNode(); CSSNode root_child2 = new CSSNode();
root_child2.Height = 10f; root_child2.Height = 10f;
root.Insert(2, root_child2); root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -523,7 +523,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(102f, root_child2.LayoutWidth); Assert.AreEqual(102f, root_child2.LayoutWidth);
Assert.AreEqual(10f, root_child2.LayoutHeight); Assert.AreEqual(10f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -551,7 +551,7 @@ namespace Facebook.CSSLayout
public void Test_justify_content_column_space_between() public void Test_justify_content_column_space_between()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.JustifyContent = CSSJustify.SpaceBetween; root.JustifyContent = YogaJustify.SpaceBetween;
root.Width = 102f; root.Width = 102f;
root.Height = 102f; root.Height = 102f;
@@ -566,7 +566,7 @@ namespace Facebook.CSSLayout
CSSNode root_child2 = new CSSNode(); CSSNode root_child2 = new CSSNode();
root_child2.Height = 10f; root_child2.Height = 10f;
root.Insert(2, root_child2); root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -589,7 +589,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(102f, root_child2.LayoutWidth); Assert.AreEqual(102f, root_child2.LayoutWidth);
Assert.AreEqual(10f, root_child2.LayoutHeight); Assert.AreEqual(10f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -617,7 +617,7 @@ namespace Facebook.CSSLayout
public void Test_justify_content_column_space_around() public void Test_justify_content_column_space_around()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.JustifyContent = CSSJustify.SpaceAround; root.JustifyContent = YogaJustify.SpaceAround;
root.Width = 102f; root.Width = 102f;
root.Height = 102f; root.Height = 102f;
@@ -632,7 +632,7 @@ namespace Facebook.CSSLayout
CSSNode root_child2 = new CSSNode(); CSSNode root_child2 = new CSSNode();
root_child2.Height = 10f; root_child2.Height = 10f;
root.Insert(2, root_child2); root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -655,7 +655,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(102f, root_child2.LayoutWidth); Assert.AreEqual(102f, root_child2.LayoutWidth);
Assert.AreEqual(10f, root_child2.LayoutHeight); Assert.AreEqual(10f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);

View File

@@ -21,15 +21,15 @@ namespace Facebook.CSSLayout
public void Test_margin_start() public void Test_margin_start()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row; root.FlexDirection = YogaFlexDirection.Row;
root.Width = 100f; root.Width = 100f;
root.Height = 100f; root.Height = 100f;
CSSNode root_child0 = new CSSNode(); CSSNode root_child0 = new CSSNode();
root_child0.SetMargin(CSSEdge.Start, 10f); root_child0.SetMargin(YogaEdge.Start, 10f);
root_child0.Width = 10f; root_child0.Width = 10f;
root.Insert(0, root_child0); root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -42,7 +42,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(10f, root_child0.LayoutWidth); Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(100f, root_child0.LayoutHeight); Assert.AreEqual(100f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -64,10 +64,10 @@ namespace Facebook.CSSLayout
root.Height = 100f; root.Height = 100f;
CSSNode root_child0 = new CSSNode(); CSSNode root_child0 = new CSSNode();
root_child0.SetMargin(CSSEdge.Top, 10f); root_child0.SetMargin(YogaEdge.Top, 10f);
root_child0.Height = 10f; root_child0.Height = 10f;
root.Insert(0, root_child0); root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -80,7 +80,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(100f, root_child0.LayoutWidth); Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight); Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -98,16 +98,16 @@ namespace Facebook.CSSLayout
public void Test_margin_end() public void Test_margin_end()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row; root.FlexDirection = YogaFlexDirection.Row;
root.JustifyContent = CSSJustify.FlexEnd; root.JustifyContent = YogaJustify.FlexEnd;
root.Width = 100f; root.Width = 100f;
root.Height = 100f; root.Height = 100f;
CSSNode root_child0 = new CSSNode(); CSSNode root_child0 = new CSSNode();
root_child0.SetMargin(CSSEdge.End, 10f); root_child0.SetMargin(YogaEdge.End, 10f);
root_child0.Width = 10f; root_child0.Width = 10f;
root.Insert(0, root_child0); root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -120,7 +120,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(10f, root_child0.LayoutWidth); Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(100f, root_child0.LayoutHeight); Assert.AreEqual(100f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -138,15 +138,15 @@ namespace Facebook.CSSLayout
public void Test_margin_bottom() public void Test_margin_bottom()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.JustifyContent = CSSJustify.FlexEnd; root.JustifyContent = YogaJustify.FlexEnd;
root.Width = 100f; root.Width = 100f;
root.Height = 100f; root.Height = 100f;
CSSNode root_child0 = new CSSNode(); CSSNode root_child0 = new CSSNode();
root_child0.SetMargin(CSSEdge.Bottom, 10f); root_child0.SetMargin(YogaEdge.Bottom, 10f);
root_child0.Height = 10f; root_child0.Height = 10f;
root.Insert(0, root_child0); root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -159,7 +159,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(100f, root_child0.LayoutWidth); Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight); Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -177,15 +177,15 @@ namespace Facebook.CSSLayout
public void Test_margin_and_flex_row() public void Test_margin_and_flex_row()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row; root.FlexDirection = YogaFlexDirection.Row;
root.Width = 100f; root.Width = 100f;
root.Height = 100f; root.Height = 100f;
CSSNode root_child0 = new CSSNode(); CSSNode root_child0 = new CSSNode();
root_child0.FlexGrow = 1f; root_child0.FlexGrow = 1f;
root_child0.SetMargin(CSSEdge.Start, 10f); root_child0.SetMargin(YogaEdge.Start, 10f);
root.Insert(0, root_child0); root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -198,7 +198,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(90f, root_child0.LayoutWidth); Assert.AreEqual(90f, root_child0.LayoutWidth);
Assert.AreEqual(100f, root_child0.LayoutHeight); Assert.AreEqual(100f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -221,9 +221,9 @@ namespace Facebook.CSSLayout
CSSNode root_child0 = new CSSNode(); CSSNode root_child0 = new CSSNode();
root_child0.FlexGrow = 1f; root_child0.FlexGrow = 1f;
root_child0.SetMargin(CSSEdge.Top, 10f); root_child0.SetMargin(YogaEdge.Top, 10f);
root.Insert(0, root_child0); root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -236,7 +236,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(100f, root_child0.LayoutWidth); Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(90f, root_child0.LayoutHeight); Assert.AreEqual(90f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -254,15 +254,15 @@ namespace Facebook.CSSLayout
public void Test_margin_and_stretch_row() public void Test_margin_and_stretch_row()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row; root.FlexDirection = YogaFlexDirection.Row;
root.Width = 100f; root.Width = 100f;
root.Height = 100f; root.Height = 100f;
CSSNode root_child0 = new CSSNode(); CSSNode root_child0 = new CSSNode();
root_child0.FlexGrow = 1f; root_child0.FlexGrow = 1f;
root_child0.SetMargin(CSSEdge.Top, 10f); root_child0.SetMargin(YogaEdge.Top, 10f);
root.Insert(0, root_child0); root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -275,7 +275,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(100f, root_child0.LayoutWidth); Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(90f, root_child0.LayoutHeight); Assert.AreEqual(90f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -298,9 +298,9 @@ namespace Facebook.CSSLayout
CSSNode root_child0 = new CSSNode(); CSSNode root_child0 = new CSSNode();
root_child0.FlexGrow = 1f; root_child0.FlexGrow = 1f;
root_child0.SetMargin(CSSEdge.Start, 10f); root_child0.SetMargin(YogaEdge.Start, 10f);
root.Insert(0, root_child0); root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -313,7 +313,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(90f, root_child0.LayoutWidth); Assert.AreEqual(90f, root_child0.LayoutWidth);
Assert.AreEqual(100f, root_child0.LayoutHeight); Assert.AreEqual(100f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -331,7 +331,7 @@ namespace Facebook.CSSLayout
public void Test_margin_with_sibling_row() public void Test_margin_with_sibling_row()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row; root.FlexDirection = YogaFlexDirection.Row;
root.Width = 100f; root.Width = 100f;
root.Height = 100f; root.Height = 100f;
@@ -342,7 +342,7 @@ namespace Facebook.CSSLayout
CSSNode root_child1 = new CSSNode(); CSSNode root_child1 = new CSSNode();
root_child1.FlexGrow = 1f; root_child1.FlexGrow = 1f;
root.Insert(1, root_child1); root.Insert(1, root_child1);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -360,7 +360,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(50f, root_child1.LayoutWidth); Assert.AreEqual(50f, root_child1.LayoutWidth);
Assert.AreEqual(100f, root_child1.LayoutHeight); Assert.AreEqual(100f, root_child1.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -393,7 +393,7 @@ namespace Facebook.CSSLayout
CSSNode root_child1 = new CSSNode(); CSSNode root_child1 = new CSSNode();
root_child1.FlexGrow = 1f; root_child1.FlexGrow = 1f;
root.Insert(1, root_child1); root.Insert(1, root_child1);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -411,7 +411,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(100f, root_child1.LayoutWidth); Assert.AreEqual(100f, root_child1.LayoutWidth);
Assert.AreEqual(50f, root_child1.LayoutHeight); Assert.AreEqual(50f, root_child1.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);

View File

@@ -28,7 +28,7 @@ namespace Facebook.CSSLayout
root_child0.MaxWidth = 50f; root_child0.MaxWidth = 50f;
root_child0.Height = 10f; root_child0.Height = 10f;
root.Insert(0, root_child0); root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -41,7 +41,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(50f, root_child0.LayoutWidth); Assert.AreEqual(50f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight); Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -59,7 +59,7 @@ namespace Facebook.CSSLayout
public void Test_max_height() public void Test_max_height()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row; root.FlexDirection = YogaFlexDirection.Row;
root.Width = 100f; root.Width = 100f;
root.Height = 100f; root.Height = 100f;
@@ -67,7 +67,7 @@ namespace Facebook.CSSLayout
root_child0.Width = 10f; root_child0.Width = 10f;
root_child0.MaxHeight = 50f; root_child0.MaxHeight = 50f;
root.Insert(0, root_child0); root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -80,7 +80,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(10f, root_child0.LayoutWidth); Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(50f, root_child0.LayoutHeight); Assert.AreEqual(50f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -109,7 +109,7 @@ namespace Facebook.CSSLayout
CSSNode root_child1 = new CSSNode(); CSSNode root_child1 = new CSSNode();
root_child1.FlexGrow = 1f; root_child1.FlexGrow = 1f;
root.Insert(1, root_child1); root.Insert(1, root_child1);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -127,7 +127,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(100f, root_child1.LayoutWidth); Assert.AreEqual(100f, root_child1.LayoutWidth);
Assert.AreEqual(20f, root_child1.LayoutHeight); Assert.AreEqual(20f, root_child1.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -150,7 +150,7 @@ namespace Facebook.CSSLayout
public void Test_min_width() public void Test_min_width()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row; root.FlexDirection = YogaFlexDirection.Row;
root.Width = 100f; root.Width = 100f;
root.Height = 100f; root.Height = 100f;
@@ -162,7 +162,7 @@ namespace Facebook.CSSLayout
CSSNode root_child1 = new CSSNode(); CSSNode root_child1 = new CSSNode();
root_child1.FlexGrow = 1f; root_child1.FlexGrow = 1f;
root.Insert(1, root_child1); root.Insert(1, root_child1);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -180,7 +180,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(20f, root_child1.LayoutWidth); Assert.AreEqual(20f, root_child1.LayoutWidth);
Assert.AreEqual(100f, root_child1.LayoutHeight); Assert.AreEqual(100f, root_child1.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -203,7 +203,7 @@ namespace Facebook.CSSLayout
public void Test_justify_content_min_max() public void Test_justify_content_min_max()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.JustifyContent = CSSJustify.Center; root.JustifyContent = YogaJustify.Center;
root.Width = 100f; root.Width = 100f;
root.MinHeight = 100f; root.MinHeight = 100f;
root.MaxHeight = 200f; root.MaxHeight = 200f;
@@ -212,7 +212,7 @@ namespace Facebook.CSSLayout
root_child0.Width = 60f; root_child0.Width = 60f;
root_child0.Height = 60f; root_child0.Height = 60f;
root.Insert(0, root_child0); root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -225,7 +225,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(60f, root_child0.LayoutWidth); Assert.AreEqual(60f, root_child0.LayoutWidth);
Assert.AreEqual(60f, root_child0.LayoutHeight); Assert.AreEqual(60f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -243,7 +243,7 @@ namespace Facebook.CSSLayout
public void Test_align_items_min_max() public void Test_align_items_min_max()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.AlignItems = CSSAlign.Center; root.AlignItems = YogaAlign.Center;
root.MinWidth = 100f; root.MinWidth = 100f;
root.MaxWidth = 200f; root.MaxWidth = 200f;
root.Height = 100f; root.Height = 100f;
@@ -252,7 +252,7 @@ namespace Facebook.CSSLayout
root_child0.Width = 60f; root_child0.Width = 60f;
root_child0.Height = 60f; root_child0.Height = 60f;
root.Insert(0, root_child0); root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -265,7 +265,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(60f, root_child0.LayoutWidth); Assert.AreEqual(60f, root_child0.LayoutWidth);
Assert.AreEqual(60f, root_child0.LayoutHeight); Assert.AreEqual(60f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -283,7 +283,7 @@ namespace Facebook.CSSLayout
public void Test_justify_content_overflow_min_max() public void Test_justify_content_overflow_min_max()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.JustifyContent = CSSJustify.Center; root.JustifyContent = YogaJustify.Center;
root.MinHeight = 100f; root.MinHeight = 100f;
root.MaxHeight = 110f; root.MaxHeight = 110f;
@@ -301,7 +301,7 @@ namespace Facebook.CSSLayout
root_child2.Width = 50f; root_child2.Width = 50f;
root_child2.Height = 50f; root_child2.Height = 50f;
root.Insert(2, root_child2); root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -324,7 +324,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(50f, root_child2.LayoutWidth); Assert.AreEqual(50f, root_child2.LayoutWidth);
Assert.AreEqual(50f, root_child2.LayoutHeight); Assert.AreEqual(50f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -356,7 +356,7 @@ namespace Facebook.CSSLayout
root.Height = 100f; root.Height = 100f;
CSSNode root_child0 = new CSSNode(); CSSNode root_child0 = new CSSNode();
root_child0.FlexDirection = CSSFlexDirection.Row; root_child0.FlexDirection = YogaFlexDirection.Row;
root_child0.MaxWidth = 100f; root_child0.MaxWidth = 100f;
root.Insert(0, root_child0); root.Insert(0, root_child0);
@@ -364,7 +364,7 @@ namespace Facebook.CSSLayout
root_child0_child0.FlexGrow = 1f; root_child0_child0.FlexGrow = 1f;
root_child0_child0.Height = 20f; root_child0_child0.Height = 20f;
root_child0.Insert(0, root_child0_child0); root_child0.Insert(0, root_child0_child0);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -382,7 +382,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(100f, root_child0_child0.LayoutWidth); Assert.AreEqual(100f, root_child0_child0.LayoutWidth);
Assert.AreEqual(20f, root_child0_child0.LayoutHeight); Assert.AreEqual(20f, root_child0_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -409,7 +409,7 @@ namespace Facebook.CSSLayout
root.Height = 100f; root.Height = 100f;
CSSNode root_child0 = new CSSNode(); CSSNode root_child0 = new CSSNode();
root_child0.FlexDirection = CSSFlexDirection.Row; root_child0.FlexDirection = YogaFlexDirection.Row;
root_child0.MaxWidth = 300f; root_child0.MaxWidth = 300f;
root.Insert(0, root_child0); root.Insert(0, root_child0);
@@ -417,7 +417,7 @@ namespace Facebook.CSSLayout
root_child0_child0.FlexGrow = 1f; root_child0_child0.FlexGrow = 1f;
root_child0_child0.Height = 20f; root_child0_child0.Height = 20f;
root_child0.Insert(0, root_child0_child0); root_child0.Insert(0, root_child0_child0);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -435,7 +435,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(200f, root_child0_child0.LayoutWidth); Assert.AreEqual(200f, root_child0_child0.LayoutWidth);
Assert.AreEqual(20f, root_child0_child0.LayoutHeight); Assert.AreEqual(20f, root_child0_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);

View File

@@ -21,11 +21,11 @@ namespace Facebook.CSSLayout
public void Test_padding_no_size() public void Test_padding_no_size()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.SetPadding(CSSEdge.Left, 10f); root.SetPadding(YogaEdge.Left, 10f);
root.SetPadding(CSSEdge.Top, 10f); root.SetPadding(YogaEdge.Top, 10f);
root.SetPadding(CSSEdge.Right, 10f); root.SetPadding(YogaEdge.Right, 10f);
root.SetPadding(CSSEdge.Bottom, 10f); root.SetPadding(YogaEdge.Bottom, 10f);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -33,7 +33,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(20f, root.LayoutWidth); Assert.AreEqual(20f, root.LayoutWidth);
Assert.AreEqual(20f, root.LayoutHeight); Assert.AreEqual(20f, root.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -46,16 +46,16 @@ namespace Facebook.CSSLayout
public void Test_padding_container_match_child() public void Test_padding_container_match_child()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.SetPadding(CSSEdge.Left, 10f); root.SetPadding(YogaEdge.Left, 10f);
root.SetPadding(CSSEdge.Top, 10f); root.SetPadding(YogaEdge.Top, 10f);
root.SetPadding(CSSEdge.Right, 10f); root.SetPadding(YogaEdge.Right, 10f);
root.SetPadding(CSSEdge.Bottom, 10f); root.SetPadding(YogaEdge.Bottom, 10f);
CSSNode root_child0 = new CSSNode(); CSSNode root_child0 = new CSSNode();
root_child0.Width = 10f; root_child0.Width = 10f;
root_child0.Height = 10f; root_child0.Height = 10f;
root.Insert(0, root_child0); root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -68,7 +68,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(10f, root_child0.LayoutWidth); Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight); Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -86,10 +86,10 @@ namespace Facebook.CSSLayout
public void Test_padding_flex_child() public void Test_padding_flex_child()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.SetPadding(CSSEdge.Left, 10f); root.SetPadding(YogaEdge.Left, 10f);
root.SetPadding(CSSEdge.Top, 10f); root.SetPadding(YogaEdge.Top, 10f);
root.SetPadding(CSSEdge.Right, 10f); root.SetPadding(YogaEdge.Right, 10f);
root.SetPadding(CSSEdge.Bottom, 10f); root.SetPadding(YogaEdge.Bottom, 10f);
root.Width = 100f; root.Width = 100f;
root.Height = 100f; root.Height = 100f;
@@ -97,7 +97,7 @@ namespace Facebook.CSSLayout
root_child0.FlexGrow = 1f; root_child0.FlexGrow = 1f;
root_child0.Width = 10f; root_child0.Width = 10f;
root.Insert(0, root_child0); root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -110,7 +110,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(10f, root_child0.LayoutWidth); Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(80f, root_child0.LayoutHeight); Assert.AreEqual(80f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -128,17 +128,17 @@ namespace Facebook.CSSLayout
public void Test_padding_stretch_child() public void Test_padding_stretch_child()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.SetPadding(CSSEdge.Left, 10f); root.SetPadding(YogaEdge.Left, 10f);
root.SetPadding(CSSEdge.Top, 10f); root.SetPadding(YogaEdge.Top, 10f);
root.SetPadding(CSSEdge.Right, 10f); root.SetPadding(YogaEdge.Right, 10f);
root.SetPadding(CSSEdge.Bottom, 10f); root.SetPadding(YogaEdge.Bottom, 10f);
root.Width = 100f; root.Width = 100f;
root.Height = 100f; root.Height = 100f;
CSSNode root_child0 = new CSSNode(); CSSNode root_child0 = new CSSNode();
root_child0.Height = 10f; root_child0.Height = 10f;
root.Insert(0, root_child0); root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -151,7 +151,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(80f, root_child0.LayoutWidth); Assert.AreEqual(80f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight); Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -169,11 +169,11 @@ namespace Facebook.CSSLayout
public void Test_padding_center_child() public void Test_padding_center_child()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.JustifyContent = CSSJustify.Center; root.JustifyContent = YogaJustify.Center;
root.AlignItems = CSSAlign.Center; root.AlignItems = YogaAlign.Center;
root.SetPadding(CSSEdge.Start, 10f); root.SetPadding(YogaEdge.Start, 10f);
root.SetPadding(CSSEdge.End, 20f); root.SetPadding(YogaEdge.End, 20f);
root.SetPadding(CSSEdge.Bottom, 20f); root.SetPadding(YogaEdge.Bottom, 20f);
root.Width = 100f; root.Width = 100f;
root.Height = 100f; root.Height = 100f;
@@ -181,7 +181,7 @@ namespace Facebook.CSSLayout
root_child0.Width = 10f; root_child0.Width = 10f;
root_child0.Height = 10f; root_child0.Height = 10f;
root.Insert(0, root_child0); root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -194,7 +194,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(10f, root_child0.LayoutWidth); Assert.AreEqual(10f, root_child0.LayoutWidth);
Assert.AreEqual(10f, root_child0.LayoutHeight); Assert.AreEqual(10f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -212,20 +212,20 @@ namespace Facebook.CSSLayout
public void Test_child_with_padding_align_end() public void Test_child_with_padding_align_end()
{ {
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.JustifyContent = CSSJustify.FlexEnd; root.JustifyContent = YogaJustify.FlexEnd;
root.AlignItems = CSSAlign.FlexEnd; root.AlignItems = YogaAlign.FlexEnd;
root.Width = 200f; root.Width = 200f;
root.Height = 200f; root.Height = 200f;
CSSNode root_child0 = new CSSNode(); CSSNode root_child0 = new CSSNode();
root_child0.SetPadding(CSSEdge.Left, 20f); root_child0.SetPadding(YogaEdge.Left, 20f);
root_child0.SetPadding(CSSEdge.Top, 20f); root_child0.SetPadding(YogaEdge.Top, 20f);
root_child0.SetPadding(CSSEdge.Right, 20f); root_child0.SetPadding(YogaEdge.Right, 20f);
root_child0.SetPadding(CSSEdge.Bottom, 20f); root_child0.SetPadding(YogaEdge.Bottom, 20f);
root_child0.Width = 100f; root_child0.Width = 100f;
root_child0.Height = 100f; root_child0.Height = 100f;
root.Insert(0, root_child0); root.Insert(0, root_child0);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -238,7 +238,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(100f, root_child0.LayoutWidth); Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(100f, root_child0.LayoutHeight); Assert.AreEqual(100f, root_child0.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);

View File

@@ -20,10 +20,10 @@ namespace Facebook.CSSLayout
[Test] [Test]
public void Test_rounding_flex_basis_flex_grow_row_width_of_100() 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(); CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row; root.FlexDirection = YogaFlexDirection.Row;
root.Width = 100f; root.Width = 100f;
root.Height = 100f; root.Height = 100f;
@@ -38,7 +38,7 @@ namespace Facebook.CSSLayout
CSSNode root_child2 = new CSSNode(); CSSNode root_child2 = new CSSNode();
root_child2.FlexGrow = 1f; root_child2.FlexGrow = 1f;
root.Insert(2, root_child2); root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -61,7 +61,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(33f, root_child2.LayoutWidth); Assert.AreEqual(33f, root_child2.LayoutWidth);
Assert.AreEqual(100f, root_child2.LayoutHeight); Assert.AreEqual(100f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -84,16 +84,16 @@ namespace Facebook.CSSLayout
Assert.AreEqual(33f, root_child2.LayoutWidth); Assert.AreEqual(33f, root_child2.LayoutWidth);
Assert.AreEqual(100f, root_child2.LayoutHeight); Assert.AreEqual(100f, root_child2.LayoutHeight);
CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, false); CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
} }
[Test] [Test]
public void Test_rounding_flex_basis_flex_grow_row_prime_number_width() 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(); CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row; root.FlexDirection = YogaFlexDirection.Row;
root.Width = 113f; root.Width = 113f;
root.Height = 100f; root.Height = 100f;
@@ -116,7 +116,7 @@ namespace Facebook.CSSLayout
CSSNode root_child4 = new CSSNode(); CSSNode root_child4 = new CSSNode();
root_child4.FlexGrow = 1f; root_child4.FlexGrow = 1f;
root.Insert(4, root_child4); root.Insert(4, root_child4);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -149,7 +149,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(23f, root_child4.LayoutWidth); Assert.AreEqual(23f, root_child4.LayoutWidth);
Assert.AreEqual(100f, root_child4.LayoutHeight); Assert.AreEqual(100f, root_child4.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -182,16 +182,16 @@ namespace Facebook.CSSLayout
Assert.AreEqual(23f, root_child4.LayoutWidth); Assert.AreEqual(23f, root_child4.LayoutWidth);
Assert.AreEqual(100f, root_child4.LayoutHeight); Assert.AreEqual(100f, root_child4.LayoutHeight);
CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, false); CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
} }
[Test] [Test]
public void Test_rounding_flex_basis_flex_shrink_row() public void Test_rounding_flex_basis_flex_shrink_row()
{ {
CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, true); CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.FlexDirection = CSSFlexDirection.Row; root.FlexDirection = YogaFlexDirection.Row;
root.Width = 101f; root.Width = 101f;
root.Height = 100f; root.Height = 100f;
@@ -207,7 +207,7 @@ namespace Facebook.CSSLayout
CSSNode root_child2 = new CSSNode(); CSSNode root_child2 = new CSSNode();
root_child2.FlexBasis = 25f; root_child2.FlexBasis = 25f;
root.Insert(2, root_child2); root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -230,7 +230,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(25f, root_child2.LayoutWidth); Assert.AreEqual(25f, root_child2.LayoutWidth);
Assert.AreEqual(100f, root_child2.LayoutHeight); Assert.AreEqual(100f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -253,13 +253,13 @@ namespace Facebook.CSSLayout
Assert.AreEqual(25f, root_child2.LayoutWidth); Assert.AreEqual(25f, root_child2.LayoutWidth);
Assert.AreEqual(100f, root_child2.LayoutHeight); Assert.AreEqual(100f, root_child2.LayoutHeight);
CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, false); CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
} }
[Test] [Test]
public void Test_rounding_flex_basis_overrides_main_size() public void Test_rounding_flex_basis_overrides_main_size()
{ {
CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, true); CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.Width = 100f; root.Width = 100f;
@@ -280,7 +280,7 @@ namespace Facebook.CSSLayout
root_child2.FlexGrow = 1f; root_child2.FlexGrow = 1f;
root_child2.Height = 10f; root_child2.Height = 10f;
root.Insert(2, root_child2); root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -303,7 +303,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(100f, root_child2.LayoutWidth); Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(24f, root_child2.LayoutHeight); Assert.AreEqual(24f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -326,13 +326,13 @@ namespace Facebook.CSSLayout
Assert.AreEqual(100f, root_child2.LayoutWidth); Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(24f, root_child2.LayoutHeight); Assert.AreEqual(24f, root_child2.LayoutHeight);
CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, false); CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
} }
[Test] [Test]
public void Test_rounding_total_fractial() public void Test_rounding_total_fractial()
{ {
CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, true); CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.Width = 87.4f; root.Width = 87.4f;
@@ -353,7 +353,7 @@ namespace Facebook.CSSLayout
root_child2.FlexGrow = 1.1f; root_child2.FlexGrow = 1.1f;
root_child2.Height = 10.7f; root_child2.Height = 10.7f;
root.Insert(2, root_child2); root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -376,7 +376,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(87f, root_child2.LayoutWidth); Assert.AreEqual(87f, root_child2.LayoutWidth);
Assert.AreEqual(24f, root_child2.LayoutHeight); Assert.AreEqual(24f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -399,13 +399,13 @@ namespace Facebook.CSSLayout
Assert.AreEqual(87f, root_child2.LayoutWidth); Assert.AreEqual(87f, root_child2.LayoutWidth);
Assert.AreEqual(24f, root_child2.LayoutHeight); Assert.AreEqual(24f, root_child2.LayoutHeight);
CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, false); CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
} }
[Test] [Test]
public void Test_rounding_total_fractial_nested() public void Test_rounding_total_fractial_nested()
{ {
CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, true); CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.Width = 87.4f; root.Width = 87.4f;
@@ -420,14 +420,14 @@ namespace Facebook.CSSLayout
CSSNode root_child0_child0 = new CSSNode(); CSSNode root_child0_child0 = new CSSNode();
root_child0_child0.FlexGrow = 1f; root_child0_child0.FlexGrow = 1f;
root_child0_child0.FlexBasis = 0.3f; 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_child0.Height = 9.9f;
root_child0.Insert(0, root_child0_child0); root_child0.Insert(0, root_child0_child0);
CSSNode root_child0_child1 = new CSSNode(); CSSNode root_child0_child1 = new CSSNode();
root_child0_child1.FlexGrow = 4f; root_child0_child1.FlexGrow = 4f;
root_child0_child1.FlexBasis = 0.3f; 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_child1.Height = 1.1f;
root_child0.Insert(1, root_child0_child1); root_child0.Insert(1, root_child0_child1);
@@ -440,7 +440,7 @@ namespace Facebook.CSSLayout
root_child2.FlexGrow = 1.1f; root_child2.FlexGrow = 1.1f;
root_child2.Height = 10.7f; root_child2.Height = 10.7f;
root.Insert(2, root_child2); root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -473,7 +473,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(87f, root_child2.LayoutWidth); Assert.AreEqual(87f, root_child2.LayoutWidth);
Assert.AreEqual(24f, root_child2.LayoutHeight); Assert.AreEqual(24f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -506,13 +506,13 @@ namespace Facebook.CSSLayout
Assert.AreEqual(87f, root_child2.LayoutWidth); Assert.AreEqual(87f, root_child2.LayoutWidth);
Assert.AreEqual(24f, root_child2.LayoutHeight); Assert.AreEqual(24f, root_child2.LayoutHeight);
CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, false); CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
} }
[Test] [Test]
public void Test_rounding_fractial_input_1() public void Test_rounding_fractial_input_1()
{ {
CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, true); CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.Width = 100f; root.Width = 100f;
@@ -533,7 +533,7 @@ namespace Facebook.CSSLayout
root_child2.FlexGrow = 1f; root_child2.FlexGrow = 1f;
root_child2.Height = 10f; root_child2.Height = 10f;
root.Insert(2, root_child2); root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -556,7 +556,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(100f, root_child2.LayoutWidth); Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(24f, root_child2.LayoutHeight); Assert.AreEqual(24f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -579,13 +579,13 @@ namespace Facebook.CSSLayout
Assert.AreEqual(100f, root_child2.LayoutWidth); Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(24f, root_child2.LayoutHeight); Assert.AreEqual(24f, root_child2.LayoutHeight);
CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, false); CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
} }
[Test] [Test]
public void Test_rounding_fractial_input_2() public void Test_rounding_fractial_input_2()
{ {
CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, true); CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.Width = 100f; root.Width = 100f;
@@ -606,7 +606,7 @@ namespace Facebook.CSSLayout
root_child2.FlexGrow = 1f; root_child2.FlexGrow = 1f;
root_child2.Height = 10f; root_child2.Height = 10f;
root.Insert(2, root_child2); root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -629,7 +629,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(100f, root_child2.LayoutWidth); Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(25f, root_child2.LayoutHeight); Assert.AreEqual(25f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -652,16 +652,16 @@ namespace Facebook.CSSLayout
Assert.AreEqual(100f, root_child2.LayoutWidth); Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(25f, root_child2.LayoutHeight); Assert.AreEqual(25f, root_child2.LayoutHeight);
CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, false); CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
} }
[Test] [Test]
public void Test_rounding_fractial_input_3() public void Test_rounding_fractial_input_3()
{ {
CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, true); CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.SetPosition(CSSEdge.Top, 0.3f); root.SetPosition(YogaEdge.Top, 0.3f);
root.Width = 100f; root.Width = 100f;
root.Height = 113.4f; root.Height = 113.4f;
@@ -680,7 +680,7 @@ namespace Facebook.CSSLayout
root_child2.FlexGrow = 1f; root_child2.FlexGrow = 1f;
root_child2.Height = 10f; root_child2.Height = 10f;
root.Insert(2, root_child2); root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -703,7 +703,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(100f, root_child2.LayoutWidth); Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(24f, root_child2.LayoutHeight); Assert.AreEqual(24f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -726,16 +726,16 @@ namespace Facebook.CSSLayout
Assert.AreEqual(100f, root_child2.LayoutWidth); Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(24f, root_child2.LayoutHeight); Assert.AreEqual(24f, root_child2.LayoutHeight);
CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, false); CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
} }
[Test] [Test]
public void Test_rounding_fractial_input_4() public void Test_rounding_fractial_input_4()
{ {
CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, true); CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, true);
CSSNode root = new CSSNode(); CSSNode root = new CSSNode();
root.SetPosition(CSSEdge.Top, 0.7f); root.SetPosition(YogaEdge.Top, 0.7f);
root.Width = 100f; root.Width = 100f;
root.Height = 113.4f; root.Height = 113.4f;
@@ -754,7 +754,7 @@ namespace Facebook.CSSLayout
root_child2.FlexGrow = 1f; root_child2.FlexGrow = 1f;
root_child2.Height = 10f; root_child2.Height = 10f;
root.Insert(2, root_child2); root.Insert(2, root_child2);
root.StyleDirection = CSSDirection.LTR; root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -777,7 +777,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(100f, root_child2.LayoutWidth); Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(24f, root_child2.LayoutHeight); Assert.AreEqual(24f, root_child2.LayoutHeight);
root.StyleDirection = CSSDirection.RTL; root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout(); root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX); Assert.AreEqual(0f, root.LayoutX);
@@ -800,7 +800,7 @@ namespace Facebook.CSSLayout
Assert.AreEqual(100f, root_child2.LayoutWidth); Assert.AreEqual(100f, root_child2.LayoutWidth);
Assert.AreEqual(24f, root_child2.LayoutHeight); Assert.AreEqual(24f, root_child2.LayoutHeight);
CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.Rounding, false); CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.Rounding, false);
} }
} }

View File

@@ -22,8 +22,8 @@ namespace Facebook.CSSLayout
public void TestSimple() public void TestSimple()
{ {
CSSNode nodeDefault = new CSSNode(); CSSNode nodeDefault = new CSSNode();
CSSNode nodeCreated = CSSNode.Create(flexDirection: CSSFlexDirection.Row); CSSNode nodeCreated = CSSNode.Create(flexDirection: YogaFlexDirection.Row);
Assert.AreEqual(CSSFlexDirection.Row, nodeCreated.FlexDirection); Assert.AreEqual(YogaFlexDirection.Row, nodeCreated.FlexDirection);
Assert.IsFalse(nodeDefault.IsDirty); Assert.IsFalse(nodeDefault.IsDirty);
nodeDefault.CopyStyle(nodeCreated); nodeDefault.CopyStyle(nodeCreated);
Assert.IsTrue(nodeDefault.IsDirty); Assert.IsTrue(nodeDefault.IsDirty);
@@ -43,39 +43,39 @@ namespace Facebook.CSSLayout
public void TestMultiple() public void TestMultiple()
{ {
CSSNode node = CSSNode.Create( CSSNode node = CSSNode.Create(
positionType: CSSPositionType.Absolute, positionType: YogaPositionType.Absolute,
wrap: CSSWrap.Wrap, wrap: YogaWrap.Wrap,
position: new Spacing(top:6, right:4), position: new Spacing(top:6, right:4),
margin: new Spacing(bottom:5, left:3)); margin: new Spacing(bottom:5, left:3));
Assert.AreEqual(CSSFlexDirection.Column, node.FlexDirection); Assert.AreEqual(YogaFlexDirection.Column, node.FlexDirection);
Assert.AreEqual(CSSPositionType.Absolute, node.PositionType); Assert.AreEqual(YogaPositionType.Absolute, node.PositionType);
Assert.AreEqual(CSSWrap.Wrap, node.Wrap); Assert.AreEqual(YogaWrap.Wrap, node.Wrap);
Assert.AreEqual(6, node.GetPosition(CSSEdge.Top)); Assert.AreEqual(6, node.GetPosition(YogaEdge.Top));
Assert.IsTrue(CSSConstants.IsUndefined(node.GetPosition(CSSEdge.Bottom))); Assert.IsTrue(YogaConstants.IsUndefined(node.GetPosition(YogaEdge.Bottom)));
Assert.AreEqual(4, node.GetPosition(CSSEdge.Right)); Assert.AreEqual(4, node.GetPosition(YogaEdge.Right));
Assert.IsTrue(CSSConstants.IsUndefined(node.GetPosition(CSSEdge.Left))); Assert.IsTrue(YogaConstants.IsUndefined(node.GetPosition(YogaEdge.Left)));
Assert.AreEqual(0, node.GetMargin(CSSEdge.Top)); Assert.AreEqual(0, node.GetMargin(YogaEdge.Top));
Assert.AreEqual(5, node.GetMargin(CSSEdge.Bottom)); Assert.AreEqual(5, node.GetMargin(YogaEdge.Bottom));
Assert.AreEqual(3, node.GetMargin(CSSEdge.Left)); Assert.AreEqual(3, node.GetMargin(YogaEdge.Left));
Assert.AreEqual(0, node.GetMargin(CSSEdge.Right)); Assert.AreEqual(0, node.GetMargin(YogaEdge.Right));
} }
[Test] [Test]
public void TestFull() public void TestFull()
{ {
CSSNode node = CSSNode.Create( CSSNode node = CSSNode.Create(
styleDirection: CSSDirection.RTL, styleDirection: YogaDirection.RTL,
flexDirection: CSSFlexDirection.RowReverse, flexDirection: YogaFlexDirection.RowReverse,
justifyContent: CSSJustify.SpaceAround, justifyContent: YogaJustify.SpaceAround,
alignContent: CSSAlign.Center, alignContent: YogaAlign.Center,
alignItems: CSSAlign.FlexEnd, alignItems: YogaAlign.FlexEnd,
alignSelf: CSSAlign.Stretch, alignSelf: YogaAlign.Stretch,
positionType: CSSPositionType.Absolute, positionType: YogaPositionType.Absolute,
wrap: CSSWrap.Wrap, wrap: YogaWrap.Wrap,
overflow: CSSOverflow.Scroll, overflow: YogaOverflow.Scroll,
flex: 1, flex: 1,
flexGrow: 2, flexGrow: 2,
@@ -94,43 +94,43 @@ namespace Facebook.CSSLayout
maxWidth: 25, maxWidth: 25,
maxHeight: 26); maxHeight: 26);
Assert.AreEqual(CSSDirection.RTL, node.StyleDirection); Assert.AreEqual(YogaDirection.RTL, node.StyleDirection);
Assert.AreEqual(CSSFlexDirection.RowReverse, node.FlexDirection); Assert.AreEqual(YogaFlexDirection.RowReverse, node.FlexDirection);
Assert.AreEqual(CSSJustify.SpaceAround, node.JustifyContent); Assert.AreEqual(YogaJustify.SpaceAround, node.JustifyContent);
Assert.AreEqual(CSSAlign.Center, node.AlignContent); Assert.AreEqual(YogaAlign.Center, node.AlignContent);
Assert.AreEqual(CSSAlign.FlexEnd, node.AlignItems); Assert.AreEqual(YogaAlign.FlexEnd, node.AlignItems);
Assert.AreEqual(CSSAlign.Stretch, node.AlignSelf); Assert.AreEqual(YogaAlign.Stretch, node.AlignSelf);
Assert.AreEqual(CSSPositionType.Absolute, node.PositionType); Assert.AreEqual(YogaPositionType.Absolute, node.PositionType);
Assert.AreEqual(CSSWrap.Wrap, node.Wrap); Assert.AreEqual(YogaWrap.Wrap, node.Wrap);
Assert.AreEqual(CSSOverflow.Scroll, node.Overflow); Assert.AreEqual(YogaOverflow.Scroll, node.Overflow);
Assert.AreEqual(2, node.FlexGrow); Assert.AreEqual(2, node.FlexGrow);
Assert.AreEqual(3, node.FlexShrink); Assert.AreEqual(3, node.FlexShrink);
Assert.AreEqual(4, node.FlexBasis); Assert.AreEqual(4, node.FlexBasis);
node.FlexGrow = CSSConstants.Undefined; node.FlexGrow = YogaConstants.Undefined;
Assert.AreEqual(1, node.FlexGrow); Assert.AreEqual(1, node.FlexGrow);
Assert.AreEqual(5, node.GetPosition(CSSEdge.Top)); Assert.AreEqual(5, node.GetPosition(YogaEdge.Top));
Assert.AreEqual(6, node.GetPosition(CSSEdge.Bottom)); Assert.AreEqual(6, node.GetPosition(YogaEdge.Bottom));
Assert.AreEqual(7, node.GetPosition(CSSEdge.Left)); Assert.AreEqual(7, node.GetPosition(YogaEdge.Left));
Assert.AreEqual(8, node.GetPosition(CSSEdge.Right)); Assert.AreEqual(8, node.GetPosition(YogaEdge.Right));
Assert.AreEqual(9, node.GetMargin(CSSEdge.Top)); Assert.AreEqual(9, node.GetMargin(YogaEdge.Top));
Assert.AreEqual(10, node.GetMargin(CSSEdge.Bottom)); Assert.AreEqual(10, node.GetMargin(YogaEdge.Bottom));
Assert.AreEqual(11, node.GetMargin(CSSEdge.Left)); Assert.AreEqual(11, node.GetMargin(YogaEdge.Left));
Assert.AreEqual(12, node.GetMargin(CSSEdge.Right)); Assert.AreEqual(12, node.GetMargin(YogaEdge.Right));
Assert.AreEqual(13, node.GetPadding(CSSEdge.Top)); Assert.AreEqual(13, node.GetPadding(YogaEdge.Top));
Assert.AreEqual(14, node.GetPadding(CSSEdge.Bottom)); Assert.AreEqual(14, node.GetPadding(YogaEdge.Bottom));
Assert.AreEqual(15, node.GetPadding(CSSEdge.Left)); Assert.AreEqual(15, node.GetPadding(YogaEdge.Left));
Assert.AreEqual(16, node.GetPadding(CSSEdge.Right)); Assert.AreEqual(16, node.GetPadding(YogaEdge.Right));
Assert.AreEqual(17, node.GetBorder(CSSEdge.Top)); Assert.AreEqual(17, node.GetBorder(YogaEdge.Top));
Assert.AreEqual(18, node.GetBorder(CSSEdge.Bottom)); Assert.AreEqual(18, node.GetBorder(YogaEdge.Bottom));
Assert.AreEqual(19, node.GetBorder(CSSEdge.Left)); Assert.AreEqual(19, node.GetBorder(YogaEdge.Left));
Assert.AreEqual(20, node.GetBorder(CSSEdge.Right)); Assert.AreEqual(20, node.GetBorder(YogaEdge.Right));
Assert.AreEqual(21, node.Width); Assert.AreEqual(21, node.Width);
Assert.AreEqual(22, node.Height); Assert.AreEqual(22, node.Height);

View File

@@ -219,7 +219,7 @@ namespace Facebook.CSSLayout
public void TestCopyStyle() public void TestCopyStyle()
{ {
CSSNode node0 = new CSSNode(); CSSNode node0 = new CSSNode();
Assert.IsTrue(CSSConstants.IsUndefined(node0.MaxHeight)); Assert.IsTrue(YogaConstants.IsUndefined(node0.MaxHeight));
CSSNode node1 = new CSSNode(); CSSNode node1 = new CSSNode();
node1.MaxHeight = 100; node1.MaxHeight = 100;

View File

@@ -12,54 +12,54 @@ from __future__ import unicode_literals
import os import os
ENUMS = { ENUMS = {
'CSSDirection': [ 'Direction': [
'Inherit', 'Inherit',
'LTR', 'LTR',
'RTL', 'RTL',
], ],
'CSSFlexDirection': [ 'FlexDirection': [
'Column', 'Column',
'ColumnReverse', 'ColumnReverse',
'Row', 'Row',
'RowReverse', 'RowReverse',
], ],
'CSSJustify': [ 'Justify': [
'FlexStart', 'FlexStart',
'Center', 'Center',
'FlexEnd', 'FlexEnd',
'SpaceBetween', 'SpaceBetween',
'SpaceAround', 'SpaceAround',
], ],
'CSSOverflow': [ 'Overflow': [
'Visible', 'Visible',
'Hidden', 'Hidden',
'Scroll', 'Scroll',
], ],
'CSSAlign': [ 'Align': [
'Auto', 'Auto',
'FlexStart', 'FlexStart',
'Center', 'Center',
'FlexEnd', 'FlexEnd',
'Stretch', 'Stretch',
], ],
'CSSPositionType': [ 'PositionType': [
'Relative', 'Relative',
'Absolute', 'Absolute',
], ],
'CSSWrap': [ 'Wrap': [
'NoWrap', 'NoWrap',
'Wrap', 'Wrap',
], ],
'CSSMeasureMode': [ 'MeasureMode': [
'Undefined', 'Undefined',
'Exactly', 'Exactly',
'AtMost', 'AtMost',
], ],
'CSSDimension': [ 'Dimension': [
'Width', 'Width',
'Height', 'Height',
], ],
'CSSEdge': [ 'Edge': [
'Left', 'Left',
'Top', 'Top',
'Right', 'Right',
@@ -70,19 +70,19 @@ ENUMS = {
'Vertical', 'Vertical',
'All', 'All',
], ],
'CSSLogLevel': [ 'LogLevel': [
'Error', 'Error',
'Warn', 'Warn',
'Info', 'Info',
'Debug', 'Debug',
'Verbose', 'Verbose',
], ],
'CSSExperimentalFeature': [ 'ExperimentalFeature': [
'Rounding', 'Rounding',
# Mimic web flex-basis behavior. # Mimic web flex-basis behavior.
'WebFlexBasis', 'WebFlexBasis',
], ],
'CSSPrintOptions': [ 'PrintOptions': [
('Layout', 1), ('Layout', 1),
('Style', 2), ('Style', 2),
('Children', 4), ('Children', 4),
@@ -118,26 +118,26 @@ with open(root + '/CSSLayout/CSSEnums.h', 'w') as f:
f.write(LICENSE) f.write(LICENSE)
remaining = len(ENUMS) remaining = len(ENUMS)
for name, values in ENUMS.items(): 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: for value in values:
if isinstance(value, tuple): 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: else:
f.write(' %s%s,\n' % (name, value)) f.write(' YG%s%s,\n' % (name, value))
f.write(' %sCount,\n' % name) f.write(' YG%sCount,\n' % name)
f.write('} %s;\n' % name) f.write('} YG%s;\n' % name)
if remaining > 1: if remaining > 1:
f.write('\n') f.write('\n')
remaining = remaining - 1 remaining = remaining - 1
# write out java files # write out java files
for name, values in ENUMS.items(): 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(LICENSE)
f.write('package com.facebook.csslayout;\n\n') f.write('package com.facebook.csslayout;\n\n')
f.write('import com.facebook.proguard.annotations.DoNotStrip;\n\n') f.write('import com.facebook.proguard.annotations.DoNotStrip;\n\n')
f.write('@DoNotStrip\n') f.write('@DoNotStrip\n')
f.write('public enum %s {\n' % name) f.write('public enum Yoga%s {\n' % name)
if len(values) > 0: if len(values) > 0:
for value in values: for value in values:
if isinstance(value, tuple): if isinstance(value, tuple):
@@ -153,7 +153,7 @@ for name, values in ENUMS.items():
f.write('\n') f.write('\n')
f.write(' private int mIntValue;\n') f.write(' private int mIntValue;\n')
f.write('\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(' mIntValue = intValue;\n')
f.write(' }\n') f.write(' }\n')
f.write('\n') f.write('\n')
@@ -161,7 +161,7 @@ for name, values in ENUMS.items():
f.write(' return mIntValue;\n') f.write(' return mIntValue;\n')
f.write(' }\n') f.write(' }\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') f.write(' switch (value) {\n')
for value in values: for value in values:
if isinstance(value, tuple): if isinstance(value, tuple):
@@ -175,10 +175,10 @@ for name, values in ENUMS.items():
# write out csharp files # write out csharp files
for name, values in ENUMS.items(): 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(LICENSE)
f.write('namespace Facebook.CSSLayout\n{\n') 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: for value in values:
if isinstance(value, tuple): if isinstance(value, tuple):
f.write(' %s = %d,\n' % (value[0], value[1])) f.write(' %s = %d,\n' % (value[0], value[1]))

View File

@@ -32,7 +32,7 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
if (experiments.length > 0) { if (experiments.length > 0) {
for (var i in experiments) { for (var i in experiments) {
this.push('CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeature' + experiments[i] +', true);'); this.push('CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeature' + experiments[i] +', true);');
} }
this.push(''); this.push('');
} }
@@ -51,7 +51,7 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
if (experiments.length > 0) { if (experiments.length > 0) {
this.push(''); this.push('');
for (var i in experiments) { 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 + ');'); this.push('ASSERT_FLOAT_EQ(' + toFloatString(v0) + ', ' + v1 + ');');
}}, }},
CSSAlignAuto:{value:'CSSAlignAuto'}, YGAlignAuto:{value:'YGAlignAuto'},
CSSAlignCenter:{value:'CSSAlignCenter'}, YGAlignCenter:{value:'YGAlignCenter'},
CSSAlignFlexEnd:{value:'CSSAlignFlexEnd'}, YGAlignFlexEnd:{value:'YGAlignFlexEnd'},
CSSAlignFlexStart:{value:'CSSAlignFlexStart'}, YGAlignFlexStart:{value:'YGAlignFlexStart'},
CSSAlignStretch:{value:'CSSAlignStretch'}, YGAlignStretch:{value:'YGAlignStretch'},
CSSDirectionInherit:{value:'CSSDirectionInherit'}, YGDirectionInherit:{value:'YGDirectionInherit'},
CSSDirectionLTR:{value:'CSSDirectionLTR'}, YGDirectionLTR:{value:'YGDirectionLTR'},
CSSDirectionRTL:{value:'CSSDirectionRTL'}, YGDirectionRTL:{value:'YGDirectionRTL'},
CSSEdgeBottom:{value:'CSSEdgeBottom'}, YGEdgeBottom:{value:'YGEdgeBottom'},
CSSEdgeEnd:{value:'CSSEdgeEnd'}, YGEdgeEnd:{value:'YGEdgeEnd'},
CSSEdgeLeft:{value:'CSSEdgeLeft'}, YGEdgeLeft:{value:'YGEdgeLeft'},
CSSEdgeRight:{value:'CSSEdgeRight'}, YGEdgeRight:{value:'YGEdgeRight'},
CSSEdgeStart:{value:'CSSEdgeStart'}, YGEdgeStart:{value:'YGEdgeStart'},
CSSEdgeTop:{value:'CSSEdgeTop'}, YGEdgeTop:{value:'YGEdgeTop'},
CSSFlexDirectionColumn:{value:'CSSFlexDirectionColumn'}, YGFlexDirectionColumn:{value:'YGFlexDirectionColumn'},
CSSFlexDirectionColumnReverse:{value:'CSSFlexDirectionColumnReverse'}, YGFlexDirectionColumnReverse:{value:'YGFlexDirectionColumnReverse'},
CSSFlexDirectionRow:{value:'CSSFlexDirectionRow'}, YGFlexDirectionRow:{value:'YGFlexDirectionRow'},
CSSFlexDirectionRowReverse:{value:'CSSFlexDirectionRowReverse'}, YGFlexDirectionRowReverse:{value:'YGFlexDirectionRowReverse'},
CSSJustifyCenter:{value:'CSSJustifyCenter'}, YGJustifyCenter:{value:'YGJustifyCenter'},
CSSJustifyFlexEnd:{value:'CSSJustifyFlexEnd'}, YGJustifyFlexEnd:{value:'YGJustifyFlexEnd'},
CSSJustifyFlexStart:{value:'CSSJustifyFlexStart'}, YGJustifyFlexStart:{value:'YGJustifyFlexStart'},
CSSJustifySpaceAround:{value:'CSSJustifySpaceAround'}, YGJustifySpaceAround:{value:'YGJustifySpaceAround'},
CSSJustifySpaceBetween:{value:'CSSJustifySpaceBetween'}, YGJustifySpaceBetween:{value:'YGJustifySpaceBetween'},
CSSOverflowHidden:{value:'CSSOverflowHidden'}, YGOverflowHidden:{value:'YGOverflowHidden'},
CSSOverflowVisible:{value:'CSSOverflowVisible'}, YGOverflowVisible:{value:'YGOverflowVisible'},
CSSPositionTypeAbsolute:{value:'CSSPositionTypeAbsolute'}, YGPositionTypeAbsolute:{value:'YGPositionTypeAbsolute'},
CSSPositionTypeRelative:{value:'CSSPositionTypeRelative'}, YGPositionTypeRelative:{value:'YGPositionTypeRelative'},
CSSWrapNoWrap:{value:'CSSWrapNoWrap'}, YGWrapNoWrap:{value:'YGWrapNoWrap'},
CSSWrapWrap:{value:'CSSWrapWrap'}, YGWrapWrap:{value:'YGWrapWrap'},
CSSUndefined:{value:'CSSUndefined'}, YGUndefined:{value:'YGUndefined'},
CSSNodeCalculateLayout:{value:function(node, dir) { 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) { CSSNodeInsertChild:{value:function(parentName, nodeName, index) {

View File

@@ -39,7 +39,7 @@ CSEmitter.prototype = Object.create(Emitter.prototype, {
if (experiments.length > 0) { if (experiments.length > 0) {
for (var i in experiments) { for (var i in experiments) {
this.push('CSSNode.SetExperimentalFeatureEnabled(CSSExperimentalFeature.' + experiments[i] +', true);'); this.push('CSSNode.SetExperimentalFeatureEnabled(YogaExperimentalFeature.' + experiments[i] +', true);');
} }
this.push(''); this.push('');
} }
@@ -53,7 +53,7 @@ CSEmitter.prototype = Object.create(Emitter.prototype, {
if (experiments.length > 0) { if (experiments.length > 0) {
this.push(''); this.push('');
for (var i in experiments) { 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 + ');'); this.push('Assert.AreEqual(' + v0 + 'f, ' + v1 + ');');
}}, }},
CSSAlignAuto:{value:'CSSAlign.Auto'}, YGAlignAuto:{value:'YogaAlign.Auto'},
CSSAlignCenter:{value:'CSSAlign.Center'}, YGAlignCenter:{value:'YogaAlign.Center'},
CSSAlignFlexEnd:{value:'CSSAlign.FlexEnd'}, YGAlignFlexEnd:{value:'YogaAlign.FlexEnd'},
CSSAlignFlexStart:{value:'CSSAlign.FlexStart'}, YGAlignFlexStart:{value:'YogaAlign.FlexStart'},
CSSAlignStretch:{value:'CSSAlign.Stretch'}, YGAlignStretch:{value:'YogaAlign.Stretch'},
CSSDirectionInherit:{value:'CSSDirection.Inherit'}, YGDirectionInherit:{value:'YogaDirection.Inherit'},
CSSDirectionLTR:{value:'CSSDirection.LTR'}, YGDirectionLTR:{value:'YogaDirection.LTR'},
CSSDirectionRTL:{value:'CSSDirection.RTL'}, YGDirectionRTL:{value:'YogaDirection.RTL'},
CSSEdgeBottom:{value:'CSSEdge.Bottom'}, YGEdgeBottom:{value:'YogaEdge.Bottom'},
CSSEdgeEnd:{value:'CSSEdge.End'}, YGEdgeEnd:{value:'YogaEdge.End'},
CSSEdgeLeft:{value:'CSSEdge.Left'}, YGEdgeLeft:{value:'YogaEdge.Left'},
CSSEdgeRight:{value:'CSSEdge.Right'}, YGEdgeRight:{value:'YogaEdge.Right'},
CSSEdgeStart:{value:'CSSEdge.Start'}, YGEdgeStart:{value:'YogaEdge.Start'},
CSSEdgeTop:{value:'CSSEdge.Top'}, YGEdgeTop:{value:'YogaEdge.Top'},
CSSFlexDirectionColumn:{value:'CSSFlexDirection.Column'}, YGFlexDirectionColumn:{value:'YogaFlexDirection.Column'},
CSSFlexDirectionColumnReverse:{value:'CSSFlexDirection.ColumnReverse'}, YGFlexDirectionColumnReverse:{value:'YogaFlexDirection.ColumnReverse'},
CSSFlexDirectionRow:{value:'CSSFlexDirection.Row'}, YGFlexDirectionRow:{value:'YogaFlexDirection.Row'},
CSSFlexDirectionRowReverse:{value:'CSSFlexDirection.RowReverse'}, YGFlexDirectionRowReverse:{value:'YogaFlexDirection.RowReverse'},
CSSJustifyCenter:{value:'CSSJustify.Center'}, YGJustifyCenter:{value:'YogaJustify.Center'},
CSSJustifyFlexEnd:{value:'CSSJustify.FlexEnd'}, YGJustifyFlexEnd:{value:'YogaJustify.FlexEnd'},
CSSJustifyFlexStart:{value:'CSSJustify.FlexStart'}, YGJustifyFlexStart:{value:'YogaJustify.FlexStart'},
CSSJustifySpaceAround:{value:'CSSJustify.SpaceAround'}, YGJustifySpaceAround:{value:'YogaJustify.SpaceAround'},
CSSJustifySpaceBetween:{value:'CSSJustify.SpaceBetween'}, YGJustifySpaceBetween:{value:'YogaJustify.SpaceBetween'},
CSSOverflowHidden:{value:'CSSOverflow.Hidden'}, YGOverflowHidden:{value:'YogaOverflow.Hidden'},
CSSOverflowVisible:{value:'CSSOverflow.Visible'}, YGOverflowVisible:{value:'YogaOverflow.Visible'},
CSSPositionTypeAbsolute:{value:'CSSPositionType.Absolute'}, YGPositionTypeAbsolute:{value:'YogaPositionType.Absolute'},
CSSPositionTypeRelative:{value:'CSSPositionType.Relative'}, YGPositionTypeRelative:{value:'YogaPositionType.Relative'},
CSSUndefined:{value:'CSSConstants.Undefined'}, YGUndefined:{value:'YogaConstants.Undefined'},
CSSWrapNoWrap:{value:'CSSWrap.NoWrap'}, YGWrapNoWrap:{value:'YogaWrap.NoWrap'},
CSSWrapWrap:{value:'CSSWrap.Wrap'}, YGWrapWrap:{value:'YogaWrap.Wrap'},
CSSNodeCalculateLayout:{value:function(node, dir) { CSSNodeCalculateLayout:{value:function(node, dir) {
this.push(node + '.StyleDirection = ' + dir + ';'); this.push(node + '.StyleDirection = ' + dir + ';');

View File

@@ -46,7 +46,7 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
if (experiments.length > 0) { if (experiments.length > 0) {
for (var i in experiments) { 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(''); this.push('');
} }
@@ -60,7 +60,7 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
if (experiments.length > 0) { if (experiments.length > 0) {
this.push(''); this.push('');
for (var i in experiments) { 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);'); this.push('assertEquals(' + v0 + 'f, ' + v1 + ', 0.0f);');
}}, }},
CSSAlignAuto:{value:'CSSAlign.AUTO'}, YGAlignAuto:{value:'YogaAlign.AUTO'},
CSSAlignCenter:{value:'CSSAlign.CENTER'}, YGAlignCenter:{value:'YogaAlign.CENTER'},
CSSAlignFlexEnd:{value:'CSSAlign.FLEX_END'}, YGAlignFlexEnd:{value:'YogaAlign.FLEX_END'},
CSSAlignFlexStart:{value:'CSSAlign.FLEX_START'}, YGAlignFlexStart:{value:'YogaAlign.FLEX_START'},
CSSAlignStretch:{value:'CSSAlign.STRETCH'}, YGAlignStretch:{value:'YogaAlign.STRETCH'},
CSSDirectionInherit:{value:'CSSDirection.INHERIT'}, YGDirectionInherit:{value:'YogaDirection.INHERIT'},
CSSDirectionLTR:{value:'CSSDirection.LTR'}, YGDirectionLTR:{value:'YogaDirection.LTR'},
CSSDirectionRTL:{value:'CSSDirection.RTL'}, YGDirectionRTL:{value:'YogaDirection.RTL'},
CSSEdgeBottom:{value:'CSSEdge.BOTTOM'}, YGEdgeBottom:{value:'YogaEdge.BOTTOM'},
CSSEdgeEnd:{value:'CSSEdge.END'}, YGEdgeEnd:{value:'YogaEdge.END'},
CSSEdgeLeft:{value:'CSSEdge.LEFT'}, YGEdgeLeft:{value:'YogaEdge.LEFT'},
CSSEdgeRight:{value:'CSSEdge.RIGHT'}, YGEdgeRight:{value:'YogaEdge.RIGHT'},
CSSEdgeStart:{value:'CSSEdge.START'}, YGEdgeStart:{value:'YogaEdge.START'},
CSSEdgeTop:{value:'CSSEdge.TOP'}, YGEdgeTop:{value:'YogaEdge.TOP'},
CSSFlexDirectionColumn:{value:'CSSFlexDirection.COLUMN'}, YGFlexDirectionColumn:{value:'YogaFlexDirection.COLUMN'},
CSSFlexDirectionColumnReverse:{value:'CSSFlexDirection.COLUMN_REVERSE'}, YGFlexDirectionColumnReverse:{value:'YogaFlexDirection.COLUMN_REVERSE'},
CSSFlexDirectionRow:{value:'CSSFlexDirection.ROW'}, YGFlexDirectionRow:{value:'YogaFlexDirection.ROW'},
CSSFlexDirectionRowReverse:{value:'CSSFlexDirection.ROW_REVERSE'}, YGFlexDirectionRowReverse:{value:'YogaFlexDirection.ROW_REVERSE'},
CSSJustifyCenter:{value:'CSSJustify.CENTER'}, YGJustifyCenter:{value:'YogaJustify.CENTER'},
CSSJustifyFlexEnd:{value:'CSSJustify.FLEX_END'}, YGJustifyFlexEnd:{value:'YogaJustify.FLEX_END'},
CSSJustifyFlexStart:{value:'CSSJustify.FLEX_START'}, YGJustifyFlexStart:{value:'YogaJustify.FLEX_START'},
CSSJustifySpaceAround:{value:'CSSJustify.SPACE_AROUND'}, YGJustifySpaceAround:{value:'YogaJustify.SPACE_AROUND'},
CSSJustifySpaceBetween:{value:'CSSJustify.SPACE_BETWEEN'}, YGJustifySpaceBetween:{value:'YogaJustify.SPACE_BETWEEN'},
CSSOverflowHidden:{value:'CSSOverflow.HIDDEN'}, YGOverflowHidden:{value:'YogaOverflow.HIDDEN'},
CSSOverflowVisible:{value:'CSSOverflow.VISIBLE'}, YGOverflowVisible:{value:'YogaOverflow.VISIBLE'},
CSSPositionTypeAbsolute:{value:'CSSPositionType.ABSOLUTE'}, YGPositionTypeAbsolute:{value:'YogaPositionType.ABSOLUTE'},
CSSPositionTypeRelative:{value:'CSSPositionType.RELATIVE'}, YGPositionTypeRelative:{value:'YogaPositionType.RELATIVE'},
CSSUndefined:{value:'CSSConstants.UNDEFINED'}, YGUndefined:{value:'YogaConstants.UNDEFINED'},
CSSWrapNoWrap:{value:'CSSWrap.NO_WRAP'}, YGWrapNoWrap:{value:'YogaWrap.NO_WRAP'},
CSSWrapWrap:{value:'CSSWrap.WRAP'}, YGWrapWrap:{value:'YogaWrap.WRAP'},
CSSNodeCalculateLayout:{value:function(node, dir) { CSSNodeCalculateLayout:{value:function(node, dir) {
this.push(node + '.setDirection(' + dir + ');'); this.push(node + '.setDirection(' + dir + ');');

View File

@@ -87,13 +87,13 @@ function printTest(e, LTRContainer, RTLContainer, genericContainer) {
'root', 'root',
null); null);
e.CSSNodeCalculateLayout('root', e.CSSDirectionLTR); e.CSSNodeCalculateLayout('root', e.YGDirectionLTR);
e.push(''); e.push('');
assertTestTree(e, LTRLayoutTree[i], 'root', null); assertTestTree(e, LTRLayoutTree[i], 'root', null);
e.push(''); e.push('');
e.CSSNodeCalculateLayout('root', e.CSSDirectionRTL); e.CSSNodeCalculateLayout('root', e.YGDirectionRTL);
e.push(''); e.push('');
assertTestTree(e, RTLLayoutTree[i], 'root', null); assertTestTree(e, RTLLayoutTree[i], 'root', null);
@@ -119,7 +119,7 @@ function assertTestTree(e, node, nodeName, parentName) {
} }
function checkDefaultValues() { 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:'flex-direction', value:'column'},
{style:'justify-content', value:'flex-start'}, {style:'justify-content', value:'flex-start'},
@@ -198,83 +198,83 @@ function setupTestTree(e, parent, node, genericNode, nodeName, parentName, index
break; break;
case 'left': case 'left':
if (genericNode.rawStyle.indexOf('start:') >= 0) { 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 { } else {
e.CSSNodeStyleSetPosition(nodeName, e.CSSEdgeLeft, pixelValue(e, node.style[style])); e.CSSNodeStyleSetPosition(nodeName, e.YGEdgeLeft, pixelValue(e, node.style[style]));
} }
break; break;
case 'top': case 'top':
e.CSSNodeStyleSetPosition(nodeName, e.CSSEdgeTop, pixelValue(e, node.style[style])); e.CSSNodeStyleSetPosition(nodeName, e.YGEdgeTop, pixelValue(e, node.style[style]));
break; break;
case 'right': case 'right':
if (genericNode.rawStyle.indexOf('end:') >= 0) { 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 { } else {
e.CSSNodeStyleSetPosition(nodeName, e.CSSEdgeRight, pixelValue(e, node.style[style])); e.CSSNodeStyleSetPosition(nodeName, e.YGEdgeRight, pixelValue(e, node.style[style]));
} }
break; break;
case 'bottom': case 'bottom':
e.CSSNodeStyleSetPosition(nodeName, e.CSSEdgeBottom, pixelValue(e, node.style[style])); e.CSSNodeStyleSetPosition(nodeName, e.YGEdgeBottom, pixelValue(e, node.style[style]));
break; break;
case 'margin-left': case 'margin-left':
if (genericNode.rawStyle.indexOf('margin-start:') >= 0) { 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 { } else {
e.CSSNodeStyleSetMargin(nodeName, e.CSSEdgeLeft, pixelValue(e, node.style[style])); e.CSSNodeStyleSetMargin(nodeName, e.YGEdgeLeft, pixelValue(e, node.style[style]));
} }
break; break;
case 'margin-top': case 'margin-top':
e.CSSNodeStyleSetMargin(nodeName, e.CSSEdgeTop, pixelValue(e, node.style[style])); e.CSSNodeStyleSetMargin(nodeName, e.YGEdgeTop, pixelValue(e, node.style[style]));
break; break;
case 'margin-right': case 'margin-right':
if (genericNode.rawStyle.indexOf('margin-end:') >= 0) { 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 { } else {
e.CSSNodeStyleSetMargin(nodeName, e.CSSEdgeRight, pixelValue(e, node.style[style])); e.CSSNodeStyleSetMargin(nodeName, e.YGEdgeRight, pixelValue(e, node.style[style]));
} }
break; break;
case 'margin-bottom': case 'margin-bottom':
e.CSSNodeStyleSetMargin(nodeName, e.CSSEdgeBottom, pixelValue(e, node.style[style])); e.CSSNodeStyleSetMargin(nodeName, e.YGEdgeBottom, pixelValue(e, node.style[style]));
break; break;
case 'padding-left': case 'padding-left':
if (genericNode.rawStyle.indexOf('padding-start:') >= 0) { 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 { } else {
e.CSSNodeStyleSetPadding(nodeName, e.CSSEdgeLeft, pixelValue(e, node.style[style])); e.CSSNodeStyleSetPadding(nodeName, e.YGEdgeLeft, pixelValue(e, node.style[style]));
} }
break; break;
case 'padding-top': case 'padding-top':
e.CSSNodeStyleSetPadding(nodeName, e.CSSEdgeTop, pixelValue(e, node.style[style])); e.CSSNodeStyleSetPadding(nodeName, e.YGEdgeTop, pixelValue(e, node.style[style]));
break; break;
case 'padding-right': case 'padding-right':
if (genericNode.rawStyle.indexOf('padding-end:') >= 0) { 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 { } else {
e.CSSNodeStyleSetPadding(nodeName, e.CSSEdgeRight, pixelValue(e, node.style[style])); e.CSSNodeStyleSetPadding(nodeName, e.YGEdgeRight, pixelValue(e, node.style[style]));
} }
break; break;
case 'padding-bottom': case 'padding-bottom':
e.CSSNodeStyleSetPadding(nodeName, e.CSSEdgeBottom, pixelValue(e, node.style[style])); e.CSSNodeStyleSetPadding(nodeName, e.YGEdgeBottom, pixelValue(e, node.style[style]));
break; break;
case 'border-left-width': case 'border-left-width':
if (genericNode.rawStyle.indexOf('border-start-width:') >= 0) { 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 { } else {
e.CSSNodeStyleSetBorder(nodeName, e.CSSEdgeLeft, pixelValue(e, node.style[style])); e.CSSNodeStyleSetBorder(nodeName, e.YGEdgeLeft, pixelValue(e, node.style[style]));
} }
break; break;
case 'border-top-width': 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; break;
case 'border-right-width': case 'border-right-width':
if (genericNode.rawStyle.indexOf('border-end-width:') >= 0) { 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 { } else {
e.CSSNodeStyleSetBorder(nodeName, e.CSSEdgeRight, pixelValue(e, node.style[style])); e.CSSNodeStyleSetBorder(nodeName, e.YGEdgeRight, pixelValue(e, node.style[style]));
} }
break; break;
case 'border-bottom-width': 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; break;
case 'width': case 'width':
e.CSSNodeStyleSetWidth(nodeName, pixelValue(e, node.style[style])); 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) { function overflowValue(e, value) {
switch (value) { switch (value) {
case 'visible': return e.CSSOverflowVisible; case 'visible': return e.YGOverflowVisible;
case 'hidden': return e.CSSOverflowHidden; case 'hidden': return e.YGOverflowHidden;
} }
} }
function wrapValue(e, value) { function wrapValue(e, value) {
switch (value) { switch (value) {
case 'wrap': return e.CSSWrapWrap; case 'wrap': return e.YGWrapWrap;
case 'nowrap': return e.CSSWrapNoWrap; case 'nowrap': return e.YGWrapNoWrap;
} }
} }
function flexDirectionValue(e, value) { function flexDirectionValue(e, value) {
switch (value) { switch (value) {
case 'row': return e.CSSFlexDirectionRow; case 'row': return e.YGFlexDirectionRow;
case 'row-reverse': return e.CSSFlexDirectionRowReverse; case 'row-reverse': return e.YGFlexDirectionRowReverse;
case 'column': return e.CSSFlexDirectionColumn; case 'column': return e.YGFlexDirectionColumn;
case 'column-reverse': return e.CSSFlexDirectionColumnReverse; case 'column-reverse': return e.YGFlexDirectionColumnReverse;
} }
} }
function justifyValue(e, value) { function justifyValue(e, value) {
switch (value) { switch (value) {
case 'center': return e.CSSJustifyCenter; case 'center': return e.YGJustifyCenter;
case 'space-around': return e.CSSJustifySpaceAround; case 'space-around': return e.YGJustifySpaceAround;
case 'space-between': return e.CSSJustifySpaceBetween; case 'space-between': return e.YGJustifySpaceBetween;
case 'flex-start': return e.CSSJustifyFlexStart; case 'flex-start': return e.YGJustifyFlexStart;
case 'flex-end': return e.CSSJustifyFlexEnd; case 'flex-end': return e.YGJustifyFlexEnd;
} }
} }
function positionValue(e, value) { function positionValue(e, value) {
switch (value) { switch (value) {
case 'absolute': return e.CSSPositionTypeAbsolute; case 'absolute': return e.YGPositionTypeAbsolute;
default: return e.CSSPositionTypeRelative default: return e.YGPositionTypeRelative
} }
} }
function directionValue(e, value) { function directionValue(e, value) {
switch (value) { switch (value) {
case 'ltr': return e.CSSDirectionLTR; case 'ltr': return e.YGDirectionLTR;
case 'rtl': return e.CSSDirectionRTL; case 'rtl': return e.YGDirectionRTL;
case 'inherit': return e.CSSDirectionInherit; case 'inherit': return e.YGDirectionInherit;
} }
} }
function alignValue(e, value) { function alignValue(e, value) {
switch (value) { switch (value) {
case 'auto': return e.CSSAlignAuto; case 'auto': return e.YGAlignAuto;
case 'center': return e.CSSAlignCenter; case 'center': return e.YGAlignCenter;
case 'stretch': return e.CSSAlignStretch; case 'stretch': return e.YGAlignStretch;
case 'flex-start': return e.CSSAlignFlexStart; case 'flex-start': return e.YGAlignFlexStart;
case 'flex-end': return e.CSSAlignFlexEnd; case 'flex-end': return e.YGAlignFlexEnd;
} }
} }
function pixelValue(e, value) { function pixelValue(e, value) {
switch (value) { switch (value) {
case 'auto': return e.CSSUndefined; case 'auto': return e.YGUndefined;
case 'undefined': return e.CSSUndefined; case 'undefined': return e.YGUndefined;
default: return value.replace('px', ''); default: return value.replace('px', '');
} }
} }

View File

@@ -13,10 +13,10 @@ import com.facebook.proguard.annotations.DoNotStrip;
/** /**
* Inteface for recieving logs from native layer. Use by setting CSSNode.setLogger(myLogger); * 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 @DoNotStrip
public interface CSSLogger { public interface CSSLogger {
@DoNotStrip @DoNotStrip
void log(CSSLogLevel level, String message); void log(YogaLogLevel level, String message);
} }

View File

@@ -39,13 +39,13 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
int feature, int feature,
boolean enabled); boolean enabled);
public static void setExperimentalFeatureEnabled( public static void setExperimentalFeatureEnabled(
CSSExperimentalFeature feature, YogaExperimentalFeature feature,
boolean enabled) { boolean enabled) {
jni_CSSLayoutSetExperimentalFeatureEnabled(feature.intValue(), enabled); jni_CSSLayoutSetExperimentalFeatureEnabled(feature.intValue(), enabled);
} }
private static native boolean jni_CSSLayoutIsExperimentalFeatureEnabled(int feature); 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()); return jni_CSSLayoutIsExperimentalFeatureEnabled(feature.intValue());
} }
@@ -61,13 +61,13 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
private boolean mHasSetPosition = false; private boolean mHasSetPosition = false;
@DoNotStrip @DoNotStrip
private float mWidth = CSSConstants.UNDEFINED; private float mWidth = YogaConstants.UNDEFINED;
@DoNotStrip @DoNotStrip
private float mHeight = CSSConstants.UNDEFINED; private float mHeight = YogaConstants.UNDEFINED;
@DoNotStrip @DoNotStrip
private float mTop = CSSConstants.UNDEFINED; private float mTop = YogaConstants.UNDEFINED;
@DoNotStrip @DoNotStrip
private float mLeft = CSSConstants.UNDEFINED; private float mLeft = YogaConstants.UNDEFINED;
@DoNotStrip @DoNotStrip
private int mLayoutDirection = 0; private int mLayoutDirection = 0;
@@ -97,10 +97,10 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
mHasSetBorder = false; mHasSetBorder = false;
mHasSetPosition = false; mHasSetPosition = false;
mWidth = CSSConstants.UNDEFINED; mWidth = YogaConstants.UNDEFINED;
mHeight = CSSConstants.UNDEFINED; mHeight = YogaConstants.UNDEFINED;
mTop = CSSConstants.UNDEFINED; mTop = YogaConstants.UNDEFINED;
mLeft = CSSConstants.UNDEFINED; mLeft = YogaConstants.UNDEFINED;
mLayoutDirection = 0; mLayoutDirection = 0;
mMeasureFunction = null; mMeasureFunction = null;
@@ -193,103 +193,103 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
private native int jni_CSSNodeStyleGetDirection(long nativePointer); private native int jni_CSSNodeStyleGetDirection(long nativePointer);
@Override @Override
public CSSDirection getStyleDirection() { public YogaDirection getStyleDirection() {
return CSSDirection.values()[jni_CSSNodeStyleGetDirection(mNativePointer)]; return YogaDirection.values()[jni_CSSNodeStyleGetDirection(mNativePointer)];
} }
private native void jni_CSSNodeStyleSetDirection(long nativePointer, int direction); private native void jni_CSSNodeStyleSetDirection(long nativePointer, int direction);
@Override @Override
public void setDirection(CSSDirection direction) { public void setDirection(YogaDirection direction) {
jni_CSSNodeStyleSetDirection(mNativePointer, direction.intValue()); jni_CSSNodeStyleSetDirection(mNativePointer, direction.intValue());
} }
private native int jni_CSSNodeStyleGetFlexDirection(long nativePointer); private native int jni_CSSNodeStyleGetFlexDirection(long nativePointer);
@Override @Override
public CSSFlexDirection getFlexDirection() { public YogaFlexDirection getFlexDirection() {
return CSSFlexDirection.values()[jni_CSSNodeStyleGetFlexDirection(mNativePointer)]; return YogaFlexDirection.values()[jni_CSSNodeStyleGetFlexDirection(mNativePointer)];
} }
private native void jni_CSSNodeStyleSetFlexDirection(long nativePointer, int flexDirection); private native void jni_CSSNodeStyleSetFlexDirection(long nativePointer, int flexDirection);
@Override @Override
public void setFlexDirection(CSSFlexDirection flexDirection) { public void setFlexDirection(YogaFlexDirection flexDirection) {
jni_CSSNodeStyleSetFlexDirection(mNativePointer, flexDirection.intValue()); jni_CSSNodeStyleSetFlexDirection(mNativePointer, flexDirection.intValue());
} }
private native int jni_CSSNodeStyleGetJustifyContent(long nativePointer); private native int jni_CSSNodeStyleGetJustifyContent(long nativePointer);
@Override @Override
public CSSJustify getJustifyContent() { public YogaJustify getJustifyContent() {
return CSSJustify.values()[jni_CSSNodeStyleGetJustifyContent(mNativePointer)]; return YogaJustify.values()[jni_CSSNodeStyleGetJustifyContent(mNativePointer)];
} }
private native void jni_CSSNodeStyleSetJustifyContent(long nativePointer, int justifyContent); private native void jni_CSSNodeStyleSetJustifyContent(long nativePointer, int justifyContent);
@Override @Override
public void setJustifyContent(CSSJustify justifyContent) { public void setJustifyContent(YogaJustify justifyContent) {
jni_CSSNodeStyleSetJustifyContent(mNativePointer, justifyContent.intValue()); jni_CSSNodeStyleSetJustifyContent(mNativePointer, justifyContent.intValue());
} }
private native int jni_CSSNodeStyleGetAlignItems(long nativePointer); private native int jni_CSSNodeStyleGetAlignItems(long nativePointer);
@Override @Override
public CSSAlign getAlignItems() { public YogaAlign getAlignItems() {
return CSSAlign.values()[jni_CSSNodeStyleGetAlignItems(mNativePointer)]; return YogaAlign.values()[jni_CSSNodeStyleGetAlignItems(mNativePointer)];
} }
private native void jni_CSSNodeStyleSetAlignItems(long nativePointer, int alignItems); private native void jni_CSSNodeStyleSetAlignItems(long nativePointer, int alignItems);
@Override @Override
public void setAlignItems(CSSAlign alignItems) { public void setAlignItems(YogaAlign alignItems) {
jni_CSSNodeStyleSetAlignItems(mNativePointer, alignItems.intValue()); jni_CSSNodeStyleSetAlignItems(mNativePointer, alignItems.intValue());
} }
private native int jni_CSSNodeStyleGetAlignSelf(long nativePointer); private native int jni_CSSNodeStyleGetAlignSelf(long nativePointer);
@Override @Override
public CSSAlign getAlignSelf() { public YogaAlign getAlignSelf() {
return CSSAlign.values()[jni_CSSNodeStyleGetAlignSelf(mNativePointer)]; return YogaAlign.values()[jni_CSSNodeStyleGetAlignSelf(mNativePointer)];
} }
private native void jni_CSSNodeStyleSetAlignSelf(long nativePointer, int alignSelf); private native void jni_CSSNodeStyleSetAlignSelf(long nativePointer, int alignSelf);
@Override @Override
public void setAlignSelf(CSSAlign alignSelf) { public void setAlignSelf(YogaAlign alignSelf) {
jni_CSSNodeStyleSetAlignSelf(mNativePointer, alignSelf.intValue()); jni_CSSNodeStyleSetAlignSelf(mNativePointer, alignSelf.intValue());
} }
private native int jni_CSSNodeStyleGetAlignContent(long nativePointer); private native int jni_CSSNodeStyleGetAlignContent(long nativePointer);
@Override @Override
public CSSAlign getAlignContent() { public YogaAlign getAlignContent() {
return CSSAlign.values()[jni_CSSNodeStyleGetAlignContent(mNativePointer)]; return YogaAlign.values()[jni_CSSNodeStyleGetAlignContent(mNativePointer)];
} }
private native void jni_CSSNodeStyleSetAlignContent(long nativePointer, int alignContent); private native void jni_CSSNodeStyleSetAlignContent(long nativePointer, int alignContent);
@Override @Override
public void setAlignContent(CSSAlign alignContent) { public void setAlignContent(YogaAlign alignContent) {
jni_CSSNodeStyleSetAlignContent(mNativePointer, alignContent.intValue()); jni_CSSNodeStyleSetAlignContent(mNativePointer, alignContent.intValue());
} }
private native int jni_CSSNodeStyleGetPositionType(long nativePointer); private native int jni_CSSNodeStyleGetPositionType(long nativePointer);
@Override @Override
public CSSPositionType getPositionType() { public YogaPositionType getPositionType() {
return CSSPositionType.values()[jni_CSSNodeStyleGetPositionType(mNativePointer)]; return YogaPositionType.values()[jni_CSSNodeStyleGetPositionType(mNativePointer)];
} }
private native void jni_CSSNodeStyleSetPositionType(long nativePointer, int positionType); private native void jni_CSSNodeStyleSetPositionType(long nativePointer, int positionType);
@Override @Override
public void setPositionType(CSSPositionType positionType) { public void setPositionType(YogaPositionType positionType) {
jni_CSSNodeStyleSetPositionType(mNativePointer, positionType.intValue()); jni_CSSNodeStyleSetPositionType(mNativePointer, positionType.intValue());
} }
private native void jni_CSSNodeStyleSetFlexWrap(long nativePointer, int wrapType); private native void jni_CSSNodeStyleSetFlexWrap(long nativePointer, int wrapType);
@Override @Override
public void setWrap(CSSWrap flexWrap) { public void setWrap(YogaWrap flexWrap) {
jni_CSSNodeStyleSetFlexWrap(mNativePointer, flexWrap.intValue()); jni_CSSNodeStyleSetFlexWrap(mNativePointer, flexWrap.intValue());
} }
private native int jni_CSSNodeStyleGetOverflow(long nativePointer); private native int jni_CSSNodeStyleGetOverflow(long nativePointer);
@Override @Override
public CSSOverflow getOverflow() { public YogaOverflow getOverflow() {
return CSSOverflow.values()[jni_CSSNodeStyleGetOverflow(mNativePointer)]; return YogaOverflow.values()[jni_CSSNodeStyleGetOverflow(mNativePointer)];
} }
private native void jni_CSSNodeStyleSetOverflow(long nativePointer, int overflow); private native void jni_CSSNodeStyleSetOverflow(long nativePointer, int overflow);
@Override @Override
public void setOverflow(CSSOverflow overflow) { public void setOverflow(YogaOverflow overflow) {
jni_CSSNodeStyleSetOverflow(mNativePointer, overflow.intValue()); jni_CSSNodeStyleSetOverflow(mNativePointer, overflow.intValue());
} }
@@ -337,64 +337,64 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
private native float jni_CSSNodeStyleGetMargin(long nativePointer, int edge); private native float jni_CSSNodeStyleGetMargin(long nativePointer, int edge);
@Override @Override
public float getMargin(CSSEdge edge) { public float getMargin(YogaEdge edge) {
if (!mHasSetMargin) { 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()); return jni_CSSNodeStyleGetMargin(mNativePointer, edge.intValue());
} }
private native void jni_CSSNodeStyleSetMargin(long nativePointer, int edge, float margin); private native void jni_CSSNodeStyleSetMargin(long nativePointer, int edge, float margin);
@Override @Override
public void setMargin(CSSEdge edge, float margin) { public void setMargin(YogaEdge edge, float margin) {
mHasSetMargin = true; mHasSetMargin = true;
jni_CSSNodeStyleSetMargin(mNativePointer, edge.intValue(), margin); jni_CSSNodeStyleSetMargin(mNativePointer, edge.intValue(), margin);
} }
private native float jni_CSSNodeStyleGetPadding(long nativePointer, int edge); private native float jni_CSSNodeStyleGetPadding(long nativePointer, int edge);
@Override @Override
public float getPadding(CSSEdge edge) { public float getPadding(YogaEdge edge) {
if (!mHasSetPadding) { 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()); return jni_CSSNodeStyleGetPadding(mNativePointer, edge.intValue());
} }
private native void jni_CSSNodeStyleSetPadding(long nativePointer, int edge, float padding); private native void jni_CSSNodeStyleSetPadding(long nativePointer, int edge, float padding);
@Override @Override
public void setPadding(CSSEdge edge, float padding) { public void setPadding(YogaEdge edge, float padding) {
mHasSetPadding = true; mHasSetPadding = true;
jni_CSSNodeStyleSetPadding(mNativePointer, edge.intValue(), padding); jni_CSSNodeStyleSetPadding(mNativePointer, edge.intValue(), padding);
} }
private native float jni_CSSNodeStyleGetBorder(long nativePointer, int edge); private native float jni_CSSNodeStyleGetBorder(long nativePointer, int edge);
@Override @Override
public float getBorder(CSSEdge edge) { public float getBorder(YogaEdge edge) {
if (!mHasSetBorder) { 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()); return jni_CSSNodeStyleGetBorder(mNativePointer, edge.intValue());
} }
private native void jni_CSSNodeStyleSetBorder(long nativePointer, int edge, float border); private native void jni_CSSNodeStyleSetBorder(long nativePointer, int edge, float border);
@Override @Override
public void setBorder(CSSEdge edge, float border) { public void setBorder(YogaEdge edge, float border) {
mHasSetBorder = true; mHasSetBorder = true;
jni_CSSNodeStyleSetBorder(mNativePointer, edge.intValue(), border); jni_CSSNodeStyleSetBorder(mNativePointer, edge.intValue(), border);
} }
private native float jni_CSSNodeStyleGetPosition(long nativePointer, int edge); private native float jni_CSSNodeStyleGetPosition(long nativePointer, int edge);
@Override @Override
public float getPosition(CSSEdge edge) { public float getPosition(YogaEdge edge) {
if (!mHasSetPosition) { if (!mHasSetPosition) {
return CSSConstants.UNDEFINED; return YogaConstants.UNDEFINED;
} }
return jni_CSSNodeStyleGetPosition(mNativePointer, edge.intValue()); return jni_CSSNodeStyleGetPosition(mNativePointer, edge.intValue());
} }
private native void jni_CSSNodeStyleSetPosition(long nativePointer, int edge, float position); private native void jni_CSSNodeStyleSetPosition(long nativePointer, int edge, float position);
@Override @Override
public void setPosition(CSSEdge edge, float position) { public void setPosition(YogaEdge edge, float position) {
mHasSetPosition = true; mHasSetPosition = true;
jni_CSSNodeStyleSetPosition(mNativePointer, edge.intValue(), position); jni_CSSNodeStyleSetPosition(mNativePointer, edge.intValue(), position);
} }
@@ -502,8 +502,8 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
} }
@Override @Override
public CSSDirection getLayoutDirection() { public YogaDirection getLayoutDirection() {
return CSSDirection.values()[mLayoutDirection]; return YogaDirection.values()[mLayoutDirection];
} }
private native void jni_CSSNodeSetHasMeasureFunc(long nativePointer, boolean hasMeasureFunc); private native void jni_CSSNodeSetHasMeasureFunc(long nativePointer, boolean hasMeasureFunc);
@@ -527,9 +527,9 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
return mMeasureFunction.measure( return mMeasureFunction.measure(
this, this,
width, width,
CSSMeasureMode.values()[widthMode], YogaMeasureMode.values()[widthMode],
height, height,
CSSMeasureMode.values()[heightMode]); YogaMeasureMode.values()[heightMode]);
} }
@Override @Override

View File

@@ -18,9 +18,9 @@ public interface CSSNodeAPI<CSSNodeType extends CSSNodeAPI> {
long measure( long measure(
CSSNodeAPI node, CSSNodeAPI node,
float width, float width,
CSSMeasureMode widthMode, YogaMeasureMode widthMode,
float height, float height,
CSSMeasureMode heightMode); YogaMeasureMode heightMode);
} }
int getChildCount(); int getChildCount();
@@ -37,21 +37,21 @@ public interface CSSNodeAPI<CSSNodeType extends CSSNodeAPI> {
void dirty(); void dirty();
void markLayoutSeen(); void markLayoutSeen();
void copyStyle(CSSNodeType srcNode); void copyStyle(CSSNodeType srcNode);
CSSDirection getStyleDirection(); YogaDirection getStyleDirection();
void setDirection(CSSDirection direction); void setDirection(YogaDirection direction);
CSSFlexDirection getFlexDirection(); YogaFlexDirection getFlexDirection();
void setFlexDirection(CSSFlexDirection flexDirection); void setFlexDirection(YogaFlexDirection flexDirection);
CSSJustify getJustifyContent(); YogaJustify getJustifyContent();
void setJustifyContent(CSSJustify justifyContent); void setJustifyContent(YogaJustify justifyContent);
CSSAlign getAlignItems(); YogaAlign getAlignItems();
void setAlignItems(CSSAlign alignItems); void setAlignItems(YogaAlign alignItems);
CSSAlign getAlignSelf(); YogaAlign getAlignSelf();
void setAlignSelf(CSSAlign alignSelf); void setAlignSelf(YogaAlign alignSelf);
CSSAlign getAlignContent(); YogaAlign getAlignContent();
void setAlignContent(CSSAlign alignContent); void setAlignContent(YogaAlign alignContent);
CSSPositionType getPositionType(); YogaPositionType getPositionType();
void setPositionType(CSSPositionType positionType); void setPositionType(YogaPositionType positionType);
void setWrap(CSSWrap flexWrap); void setWrap(YogaWrap flexWrap);
void setFlex(float flex); void setFlex(float flex);
float getFlexGrow(); float getFlexGrow();
void setFlexGrow(float flexGrow); void setFlexGrow(float flexGrow);
@@ -59,14 +59,14 @@ public interface CSSNodeAPI<CSSNodeType extends CSSNodeAPI> {
void setFlexShrink(float flexShrink); void setFlexShrink(float flexShrink);
float getFlexBasis(); float getFlexBasis();
void setFlexBasis(float flexBasis); void setFlexBasis(float flexBasis);
float getMargin(CSSEdge edge); float getMargin(YogaEdge edge);
void setMargin(CSSEdge edge, float margin); void setMargin(YogaEdge edge, float margin);
float getPadding(CSSEdge edge); float getPadding(YogaEdge edge);
void setPadding(CSSEdge edge, float padding); void setPadding(YogaEdge edge, float padding);
float getBorder(CSSEdge edge); float getBorder(YogaEdge edge);
void setBorder(CSSEdge edge, float border); void setBorder(YogaEdge edge, float border);
float getPosition(CSSEdge edge); float getPosition(YogaEdge edge);
void setPosition(CSSEdge edge, float position); void setPosition(YogaEdge edge, float position);
float getWidth(); float getWidth();
void setWidth(float width); void setWidth(float width);
float getHeight(); float getHeight();
@@ -83,9 +83,9 @@ public interface CSSNodeAPI<CSSNodeType extends CSSNodeAPI> {
float getLayoutY(); float getLayoutY();
float getLayoutWidth(); float getLayoutWidth();
float getLayoutHeight(); float getLayoutHeight();
CSSDirection getLayoutDirection(); YogaDirection getLayoutDirection();
CSSOverflow getOverflow(); YogaOverflow getOverflow();
void setOverflow(CSSOverflow overflow); void setOverflow(YogaOverflow overflow);
void setData(Object data); void setData(Object data);
Object getData(); Object getData();
void reset(); void reset();

View File

@@ -12,7 +12,7 @@ package com.facebook.csslayout;
import com.facebook.proguard.annotations.DoNotStrip; import com.facebook.proguard.annotations.DoNotStrip;
@DoNotStrip @DoNotStrip
public enum CSSAlign { public enum YogaAlign {
AUTO(0), AUTO(0),
FLEX_START(1), FLEX_START(1),
CENTER(2), CENTER(2),
@@ -21,7 +21,7 @@ public enum CSSAlign {
private int mIntValue; private int mIntValue;
CSSAlign(int intValue) { YogaAlign(int intValue) {
mIntValue = intValue; mIntValue = intValue;
} }
@@ -29,7 +29,7 @@ public enum CSSAlign {
return mIntValue; return mIntValue;
} }
public static CSSAlign fromInt(int value) { public static YogaAlign fromInt(int value) {
switch (value) { switch (value) {
case 0: return AUTO; case 0: return AUTO;
case 1: return FLEX_START; case 1: return FLEX_START;

View File

@@ -9,7 +9,7 @@
package com.facebook.csslayout; package com.facebook.csslayout;
public class CSSConstants { public class YogaConstants {
public static final float UNDEFINED = Float.NaN; public static final float UNDEFINED = Float.NaN;

View File

@@ -12,13 +12,13 @@ package com.facebook.csslayout;
import com.facebook.proguard.annotations.DoNotStrip; import com.facebook.proguard.annotations.DoNotStrip;
@DoNotStrip @DoNotStrip
public enum CSSDimension { public enum YogaDimension {
WIDTH(0), WIDTH(0),
HEIGHT(1); HEIGHT(1);
private int mIntValue; private int mIntValue;
CSSDimension(int intValue) { YogaDimension(int intValue) {
mIntValue = intValue; mIntValue = intValue;
} }
@@ -26,7 +26,7 @@ public enum CSSDimension {
return mIntValue; return mIntValue;
} }
public static CSSDimension fromInt(int value) { public static YogaDimension fromInt(int value) {
switch (value) { switch (value) {
case 0: return WIDTH; case 0: return WIDTH;
case 1: return HEIGHT; case 1: return HEIGHT;

View File

@@ -12,14 +12,14 @@ package com.facebook.csslayout;
import com.facebook.proguard.annotations.DoNotStrip; import com.facebook.proguard.annotations.DoNotStrip;
@DoNotStrip @DoNotStrip
public enum CSSDirection { public enum YogaDirection {
INHERIT(0), INHERIT(0),
LTR(1), LTR(1),
RTL(2); RTL(2);
private int mIntValue; private int mIntValue;
CSSDirection(int intValue) { YogaDirection(int intValue) {
mIntValue = intValue; mIntValue = intValue;
} }
@@ -27,7 +27,7 @@ public enum CSSDirection {
return mIntValue; return mIntValue;
} }
public static CSSDirection fromInt(int value) { public static YogaDirection fromInt(int value) {
switch (value) { switch (value) {
case 0: return INHERIT; case 0: return INHERIT;
case 1: return LTR; case 1: return LTR;

View File

@@ -12,7 +12,7 @@ package com.facebook.csslayout;
import com.facebook.proguard.annotations.DoNotStrip; import com.facebook.proguard.annotations.DoNotStrip;
@DoNotStrip @DoNotStrip
public enum CSSEdge { public enum YogaEdge {
LEFT(0), LEFT(0),
TOP(1), TOP(1),
RIGHT(2), RIGHT(2),
@@ -25,7 +25,7 @@ public enum CSSEdge {
private int mIntValue; private int mIntValue;
CSSEdge(int intValue) { YogaEdge(int intValue) {
mIntValue = intValue; mIntValue = intValue;
} }
@@ -33,7 +33,7 @@ public enum CSSEdge {
return mIntValue; return mIntValue;
} }
public static CSSEdge fromInt(int value) { public static YogaEdge fromInt(int value) {
switch (value) { switch (value) {
case 0: return LEFT; case 0: return LEFT;
case 1: return TOP; case 1: return TOP;

View File

@@ -12,13 +12,13 @@ package com.facebook.csslayout;
import com.facebook.proguard.annotations.DoNotStrip; import com.facebook.proguard.annotations.DoNotStrip;
@DoNotStrip @DoNotStrip
public enum CSSExperimentalFeature { public enum YogaExperimentalFeature {
ROUNDING(0), ROUNDING(0),
WEB_FLEX_BASIS(1); WEB_FLEX_BASIS(1);
private int mIntValue; private int mIntValue;
CSSExperimentalFeature(int intValue) { YogaExperimentalFeature(int intValue) {
mIntValue = intValue; mIntValue = intValue;
} }
@@ -26,7 +26,7 @@ public enum CSSExperimentalFeature {
return mIntValue; return mIntValue;
} }
public static CSSExperimentalFeature fromInt(int value) { public static YogaExperimentalFeature fromInt(int value) {
switch (value) { switch (value) {
case 0: return ROUNDING; case 0: return ROUNDING;
case 1: return WEB_FLEX_BASIS; case 1: return WEB_FLEX_BASIS;

View File

@@ -12,7 +12,7 @@ package com.facebook.csslayout;
import com.facebook.proguard.annotations.DoNotStrip; import com.facebook.proguard.annotations.DoNotStrip;
@DoNotStrip @DoNotStrip
public enum CSSFlexDirection { public enum YogaFlexDirection {
COLUMN(0), COLUMN(0),
COLUMN_REVERSE(1), COLUMN_REVERSE(1),
ROW(2), ROW(2),
@@ -20,7 +20,7 @@ public enum CSSFlexDirection {
private int mIntValue; private int mIntValue;
CSSFlexDirection(int intValue) { YogaFlexDirection(int intValue) {
mIntValue = intValue; mIntValue = intValue;
} }
@@ -28,7 +28,7 @@ public enum CSSFlexDirection {
return mIntValue; return mIntValue;
} }
public static CSSFlexDirection fromInt(int value) { public static YogaFlexDirection fromInt(int value) {
switch (value) { switch (value) {
case 0: return COLUMN; case 0: return COLUMN;
case 1: return COLUMN_REVERSE; case 1: return COLUMN_REVERSE;

View File

@@ -12,7 +12,7 @@ package com.facebook.csslayout;
import com.facebook.proguard.annotations.DoNotStrip; import com.facebook.proguard.annotations.DoNotStrip;
@DoNotStrip @DoNotStrip
public enum CSSJustify { public enum YogaJustify {
FLEX_START(0), FLEX_START(0),
CENTER(1), CENTER(1),
FLEX_END(2), FLEX_END(2),
@@ -21,7 +21,7 @@ public enum CSSJustify {
private int mIntValue; private int mIntValue;
CSSJustify(int intValue) { YogaJustify(int intValue) {
mIntValue = intValue; mIntValue = intValue;
} }
@@ -29,7 +29,7 @@ public enum CSSJustify {
return mIntValue; return mIntValue;
} }
public static CSSJustify fromInt(int value) { public static YogaJustify fromInt(int value) {
switch (value) { switch (value) {
case 0: return FLEX_START; case 0: return FLEX_START;
case 1: return CENTER; case 1: return CENTER;

View File

@@ -12,7 +12,7 @@ package com.facebook.csslayout;
import com.facebook.proguard.annotations.DoNotStrip; import com.facebook.proguard.annotations.DoNotStrip;
@DoNotStrip @DoNotStrip
public enum CSSLogLevel { public enum YogaLogLevel {
ERROR(0), ERROR(0),
WARN(1), WARN(1),
INFO(2), INFO(2),
@@ -21,7 +21,7 @@ public enum CSSLogLevel {
private int mIntValue; private int mIntValue;
CSSLogLevel(int intValue) { YogaLogLevel(int intValue) {
mIntValue = intValue; mIntValue = intValue;
} }
@@ -29,7 +29,7 @@ public enum CSSLogLevel {
return mIntValue; return mIntValue;
} }
public static CSSLogLevel fromInt(int value) { public static YogaLogLevel fromInt(int value) {
switch (value) { switch (value) {
case 0: return ERROR; case 0: return ERROR;
case 1: return WARN; case 1: return WARN;

View File

@@ -12,14 +12,14 @@ package com.facebook.csslayout;
import com.facebook.proguard.annotations.DoNotStrip; import com.facebook.proguard.annotations.DoNotStrip;
@DoNotStrip @DoNotStrip
public enum CSSMeasureMode { public enum YogaMeasureMode {
UNDEFINED(0), UNDEFINED(0),
EXACTLY(1), EXACTLY(1),
AT_MOST(2); AT_MOST(2);
private int mIntValue; private int mIntValue;
CSSMeasureMode(int intValue) { YogaMeasureMode(int intValue) {
mIntValue = intValue; mIntValue = intValue;
} }
@@ -27,7 +27,7 @@ public enum CSSMeasureMode {
return mIntValue; return mIntValue;
} }
public static CSSMeasureMode fromInt(int value) { public static YogaMeasureMode fromInt(int value) {
switch (value) { switch (value) {
case 0: return UNDEFINED; case 0: return UNDEFINED;
case 1: return EXACTLY; case 1: return EXACTLY;

View File

@@ -12,14 +12,14 @@ package com.facebook.csslayout;
import com.facebook.proguard.annotations.DoNotStrip; import com.facebook.proguard.annotations.DoNotStrip;
@DoNotStrip @DoNotStrip
public enum CSSOverflow { public enum YogaOverflow {
VISIBLE(0), VISIBLE(0),
HIDDEN(1), HIDDEN(1),
SCROLL(2); SCROLL(2);
private int mIntValue; private int mIntValue;
CSSOverflow(int intValue) { YogaOverflow(int intValue) {
mIntValue = intValue; mIntValue = intValue;
} }
@@ -27,7 +27,7 @@ public enum CSSOverflow {
return mIntValue; return mIntValue;
} }
public static CSSOverflow fromInt(int value) { public static YogaOverflow fromInt(int value) {
switch (value) { switch (value) {
case 0: return VISIBLE; case 0: return VISIBLE;
case 1: return HIDDEN; case 1: return HIDDEN;

View File

@@ -12,13 +12,13 @@ package com.facebook.csslayout;
import com.facebook.proguard.annotations.DoNotStrip; import com.facebook.proguard.annotations.DoNotStrip;
@DoNotStrip @DoNotStrip
public enum CSSPositionType { public enum YogaPositionType {
RELATIVE(0), RELATIVE(0),
ABSOLUTE(1); ABSOLUTE(1);
private int mIntValue; private int mIntValue;
CSSPositionType(int intValue) { YogaPositionType(int intValue) {
mIntValue = intValue; mIntValue = intValue;
} }
@@ -26,7 +26,7 @@ public enum CSSPositionType {
return mIntValue; return mIntValue;
} }
public static CSSPositionType fromInt(int value) { public static YogaPositionType fromInt(int value) {
switch (value) { switch (value) {
case 0: return RELATIVE; case 0: return RELATIVE;
case 1: return ABSOLUTE; case 1: return ABSOLUTE;

View File

@@ -12,14 +12,14 @@ package com.facebook.csslayout;
import com.facebook.proguard.annotations.DoNotStrip; import com.facebook.proguard.annotations.DoNotStrip;
@DoNotStrip @DoNotStrip
public enum CSSPrintOptions { public enum YogaPrintOptions {
LAYOUT(1), LAYOUT(1),
STYLE(2), STYLE(2),
CHILDREN(4); CHILDREN(4);
private int mIntValue; private int mIntValue;
CSSPrintOptions(int intValue) { YogaPrintOptions(int intValue) {
mIntValue = intValue; mIntValue = intValue;
} }
@@ -27,7 +27,7 @@ public enum CSSPrintOptions {
return mIntValue; return mIntValue;
} }
public static CSSPrintOptions fromInt(int value) { public static YogaPrintOptions fromInt(int value) {
switch (value) { switch (value) {
case 1: return LAYOUT; case 1: return LAYOUT;
case 2: return STYLE; case 2: return STYLE;

View File

@@ -12,13 +12,13 @@ package com.facebook.csslayout;
import com.facebook.proguard.annotations.DoNotStrip; import com.facebook.proguard.annotations.DoNotStrip;
@DoNotStrip @DoNotStrip
public enum CSSWrap { public enum YogaWrap {
NO_WRAP(0), NO_WRAP(0),
WRAP(1); WRAP(1);
private int mIntValue; private int mIntValue;
CSSWrap(int intValue) { YogaWrap(int intValue) {
mIntValue = intValue; mIntValue = intValue;
} }
@@ -26,7 +26,7 @@ public enum CSSWrap {
return mIntValue; return mIntValue;
} }
public static CSSWrap fromInt(int value) { public static YogaWrap fromInt(int value) {
switch (value) { switch (value) {
case 0: return NO_WRAP; case 0: return NO_WRAP;
case 1: return WRAP; case 1: return WRAP;

View File

@@ -40,7 +40,7 @@ static void _jniTransferLayoutOutputsRecursive(CSSNodeRef root) {
_jniTransferLayoutOutputsRecursive(CSSNodeGetChild(root, i)); _jniTransferLayoutOutputsRecursive(CSSNodeGetChild(root, i));
} }
} else { } 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()) { if (auto obj = jobjectContext(node)->lockLocal()) {
cout << obj->toString() << endl; cout << obj->toString() << endl;
} else { } 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, static CSSSize _jniMeasureFunc(CSSNodeRef node,
float width, float width,
CSSMeasureMode widthMode, YGMeasureMode widthMode,
float height, float height,
CSSMeasureMode heightMode) { YGMeasureMode heightMode) {
if (auto obj = jobjectContext(node)->lockLocal()) { if (auto obj = jobjectContext(node)->lockLocal()) {
static auto measureFunc = findClassLocal("com/facebook/csslayout/CSSNode") static auto measureFunc = findClassLocal("com/facebook/csslayout/CSSNode")
->getMethod<jlong(jfloat, jint, jfloat, jint)>("measure"); ->getMethod<jlong(jfloat, jint, jfloat, jint)>("measure");
@@ -72,31 +72,31 @@ static CSSSize _jniMeasureFunc(CSSNodeRef node,
return CSSSize{measuredWidth, measuredHeight}; return CSSSize{measuredWidth, measuredHeight};
} else { } else {
CSSLog(CSSLogLevelError, "Java CSSNode was GCed during layout calculation\n"); CSSLog(YGLogLevelError, "Java CSSNode was GCed during layout calculation\n");
return CSSSize{ return CSSSize{
widthMode == CSSMeasureModeUndefined ? 0 : width, widthMode == YGMeasureModeUndefined ? 0 : width,
heightMode == CSSMeasureModeUndefined ? 0 : height, heightMode == YGMeasureModeUndefined ? 0 : height,
}; };
} }
} }
struct JCSSLogLevel : public JavaClass<JCSSLogLevel> { struct JYogaLogLevel : public JavaClass<JYogaLogLevel> {
static constexpr auto kJavaDescriptor = "Lcom/facebook/csslayout/CSSLogLevel;"; static constexpr auto kJavaDescriptor = "Lcom/facebook/csslayout/YogaLogLevel;";
}; };
static global_ref<jobject> *jLogger; static global_ref<jobject> *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]; char buffer[256];
int result = vsnprintf(buffer, sizeof(buffer), format, args); int result = vsnprintf(buffer, sizeof(buffer), format, args);
static auto logFunc = findClassLocal("com/facebook/csslayout/CSSLogger") static auto logFunc = findClassLocal("com/facebook/csslayout/CSSLogger")
->getMethod<void(local_ref<JCSSLogLevel>, jstring)>("log"); ->getMethod<void(local_ref<JYogaLogLevel>, jstring)>("log");
static auto logLevelFromInt = static auto logLevelFromInt =
JCSSLogLevel::javaClassStatic()->getStaticMethod<JCSSLogLevel::javaobject(jint)>("fromInt"); JYogaLogLevel::javaClassStatic()->getStaticMethod<JYogaLogLevel::javaobject(jint)>("fromInt");
logFunc(jLogger->get(), logFunc(jLogger->get(),
logLevelFromInt(JCSSLogLevel::javaClassStatic(), static_cast<jint>(level)), logLevelFromInt(JYogaLogLevel::javaClassStatic(), static_cast<jint>(level)),
Environment::current()->NewStringUTF(buffer)); Environment::current()->NewStringUTF(buffer));
return result; return result;
@@ -123,18 +123,18 @@ void jni_CSSLayoutSetLogger(alias_ref<jclass> clazz, alias_ref<jobject> logger)
void jni_CSSLog(alias_ref<jclass> clazz, jint level, jstring message) { void jni_CSSLog(alias_ref<jclass> clazz, jint level, jstring message) {
const char *nMessage = Environment::current()->GetStringUTFChars(message, 0); const char *nMessage = Environment::current()->GetStringUTFChars(message, 0);
CSSLog(static_cast<CSSLogLevel>(level), "%s", nMessage); CSSLog(static_cast<YGLogLevel>(level), "%s", nMessage);
Environment::current()->ReleaseStringUTFChars(message, nMessage); Environment::current()->ReleaseStringUTFChars(message, nMessage);
} }
void jni_CSSLayoutSetExperimentalFeatureEnabled(alias_ref<jclass> clazz, void jni_CSSLayoutSetExperimentalFeatureEnabled(alias_ref<jclass> clazz,
jint feature, jint feature,
jboolean enabled) { jboolean enabled) {
CSSLayoutSetExperimentalFeatureEnabled(static_cast<CSSExperimentalFeature>(feature), enabled); CSSLayoutSetExperimentalFeatureEnabled(static_cast<YGExperimentalFeature>(feature), enabled);
} }
jboolean jni_CSSLayoutIsExperimentalFeatureEnabled(alias_ref<jclass> clazz, jint feature) { jboolean jni_CSSLayoutIsExperimentalFeatureEnabled(alias_ref<jclass> clazz, jint feature) {
return CSSLayoutIsExperimentalFeatureEnabled(static_cast<CSSExperimentalFeature>(feature)); return CSSLayoutIsExperimentalFeatureEnabled(static_cast<YGExperimentalFeature>(feature));
} }
jint jni_CSSNodeGetInstanceCount(alias_ref<jclass> clazz) { jint jni_CSSNodeGetInstanceCount(alias_ref<jclass> clazz) {
@@ -176,8 +176,8 @@ void jni_CSSNodeRemoveChild(alias_ref<jobject>, jlong nativePointer, jlong child
void jni_CSSNodeCalculateLayout(alias_ref<jobject>, jlong nativePointer) { void jni_CSSNodeCalculateLayout(alias_ref<jobject>, jlong nativePointer) {
const CSSNodeRef root = _jlong2CSSNodeRef(nativePointer); const CSSNodeRef root = _jlong2CSSNodeRef(nativePointer);
CSSNodeCalculateLayout(root, CSSNodeCalculateLayout(root,
CSSUndefined, YGUndefined,
CSSUndefined, YGUndefined,
CSSNodeStyleGetDirection(_jlong2CSSNodeRef(nativePointer))); CSSNodeStyleGetDirection(_jlong2CSSNodeRef(nativePointer)));
_jniTransferLayoutOutputsRecursive(root); _jniTransferLayoutOutputsRecursive(root);
} }
@@ -220,7 +220,7 @@ void jni_CSSNodeCopyStyle(alias_ref<jobject>, jlong dstNativePointer, jlong srcN
#define CSS_NODE_JNI_STYLE_EDGE_PROP(javatype, type, name) \ #define CSS_NODE_JNI_STYLE_EDGE_PROP(javatype, type, name) \
javatype jni_CSSNodeStyleGet##name(alias_ref<jobject>, jlong nativePointer, jint edge) { \ javatype jni_CSSNodeStyleGet##name(alias_ref<jobject>, jlong nativePointer, jint edge) { \
return (javatype) CSSNodeStyleGet##name(_jlong2CSSNodeRef(nativePointer), \ return (javatype) CSSNodeStyleGet##name(_jlong2CSSNodeRef(nativePointer), \
static_cast<CSSEdge>(edge)); \ static_cast<YGEdge>(edge)); \
} \ } \
\ \
void jni_CSSNodeStyleSet##name(alias_ref<jobject>, \ void jni_CSSNodeStyleSet##name(alias_ref<jobject>, \
@@ -228,19 +228,19 @@ void jni_CSSNodeCopyStyle(alias_ref<jobject>, jlong dstNativePointer, jlong srcN
jint edge, \ jint edge, \
javatype value) { \ javatype value) { \
CSSNodeStyleSet##name(_jlong2CSSNodeRef(nativePointer), \ CSSNodeStyleSet##name(_jlong2CSSNodeRef(nativePointer), \
static_cast<CSSEdge>(edge), \ static_cast<YGEdge>(edge), \
static_cast<type>(value)); \ static_cast<type>(value)); \
} }
CSS_NODE_JNI_STYLE_PROP(jint, CSSDirection, Direction); CSS_NODE_JNI_STYLE_PROP(jint, YGDirection, Direction);
CSS_NODE_JNI_STYLE_PROP(jint, CSSFlexDirection, FlexDirection); CSS_NODE_JNI_STYLE_PROP(jint, YGFlexDirection, FlexDirection);
CSS_NODE_JNI_STYLE_PROP(jint, CSSJustify, JustifyContent); CSS_NODE_JNI_STYLE_PROP(jint, YGJustify, JustifyContent);
CSS_NODE_JNI_STYLE_PROP(jint, CSSAlign, AlignItems); CSS_NODE_JNI_STYLE_PROP(jint, YGAlign, AlignItems);
CSS_NODE_JNI_STYLE_PROP(jint, CSSAlign, AlignSelf); CSS_NODE_JNI_STYLE_PROP(jint, YGAlign, AlignSelf);
CSS_NODE_JNI_STYLE_PROP(jint, CSSAlign, AlignContent); CSS_NODE_JNI_STYLE_PROP(jint, YGAlign, AlignContent);
CSS_NODE_JNI_STYLE_PROP(jint, CSSPositionType, PositionType); CSS_NODE_JNI_STYLE_PROP(jint, YGPositionType, PositionType);
CSS_NODE_JNI_STYLE_PROP(jint, CSSWrap, FlexWrap); CSS_NODE_JNI_STYLE_PROP(jint, YGWrap, FlexWrap);
CSS_NODE_JNI_STYLE_PROP(jint, CSSOverflow, Overflow); CSS_NODE_JNI_STYLE_PROP(jint, YGOverflow, Overflow);
void jni_CSSNodeStyleSetFlex(alias_ref<jobject>, jlong nativePointer, jfloat value) { void jni_CSSNodeStyleSetFlex(alias_ref<jobject>, jlong nativePointer, jfloat value) {
CSSNodeStyleSetFlex(_jlong2CSSNodeRef(nativePointer), static_cast<float>(value)); CSSNodeStyleSetFlex(_jlong2CSSNodeRef(nativePointer), static_cast<float>(value));

View File

@@ -23,13 +23,13 @@ public class CSSLayoutAbsolutePositionTest {
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final CSSNode root_child0 = new CSSNode();
root_child0.setPositionType(CSSPositionType.ABSOLUTE); root_child0.setPositionType(YogaPositionType.ABSOLUTE);
root_child0.setPosition(CSSEdge.START, 10f); root_child0.setPosition(YogaEdge.START, 10f);
root_child0.setPosition(CSSEdge.TOP, 10f); root_child0.setPosition(YogaEdge.TOP, 10f);
root_child0.setWidth(10f); root_child0.setWidth(10f);
root_child0.setHeight(10f); root_child0.setHeight(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -42,7 +42,7 @@ public class CSSLayoutAbsolutePositionTest {
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -63,13 +63,13 @@ public class CSSLayoutAbsolutePositionTest {
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final CSSNode root_child0 = new CSSNode();
root_child0.setPositionType(CSSPositionType.ABSOLUTE); root_child0.setPositionType(YogaPositionType.ABSOLUTE);
root_child0.setPosition(CSSEdge.END, 10f); root_child0.setPosition(YogaEdge.END, 10f);
root_child0.setPosition(CSSEdge.BOTTOM, 10f); root_child0.setPosition(YogaEdge.BOTTOM, 10f);
root_child0.setWidth(10f); root_child0.setWidth(10f);
root_child0.setHeight(10f); root_child0.setHeight(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -82,7 +82,7 @@ public class CSSLayoutAbsolutePositionTest {
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -103,13 +103,13 @@ public class CSSLayoutAbsolutePositionTest {
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final CSSNode root_child0 = new CSSNode();
root_child0.setPositionType(CSSPositionType.ABSOLUTE); root_child0.setPositionType(YogaPositionType.ABSOLUTE);
root_child0.setPosition(CSSEdge.START, 10f); root_child0.setPosition(YogaEdge.START, 10f);
root_child0.setPosition(CSSEdge.TOP, 10f); root_child0.setPosition(YogaEdge.TOP, 10f);
root_child0.setPosition(CSSEdge.END, 10f); root_child0.setPosition(YogaEdge.END, 10f);
root_child0.setPosition(CSSEdge.BOTTOM, 10f); root_child0.setPosition(YogaEdge.BOTTOM, 10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -122,7 +122,7 @@ public class CSSLayoutAbsolutePositionTest {
assertEquals(80f, root_child0.getLayoutWidth(), 0.0f); assertEquals(80f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(80f, root_child0.getLayoutHeight(), 0.0f); assertEquals(80f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -143,15 +143,15 @@ public class CSSLayoutAbsolutePositionTest {
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final CSSNode root_child0 = new CSSNode();
root_child0.setPositionType(CSSPositionType.ABSOLUTE); root_child0.setPositionType(YogaPositionType.ABSOLUTE);
root_child0.setPosition(CSSEdge.START, 10f); root_child0.setPosition(YogaEdge.START, 10f);
root_child0.setPosition(CSSEdge.TOP, 10f); root_child0.setPosition(YogaEdge.TOP, 10f);
root_child0.setPosition(CSSEdge.END, 10f); root_child0.setPosition(YogaEdge.END, 10f);
root_child0.setPosition(CSSEdge.BOTTOM, 10f); root_child0.setPosition(YogaEdge.BOTTOM, 10f);
root_child0.setWidth(10f); root_child0.setWidth(10f);
root_child0.setHeight(10f); root_child0.setHeight(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -164,7 +164,7 @@ public class CSSLayoutAbsolutePositionTest {
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -181,22 +181,22 @@ public class CSSLayoutAbsolutePositionTest {
@Test @Test
public void test_do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent() { public void test_do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setOverflow(CSSOverflow.HIDDEN); root.setOverflow(YogaOverflow.HIDDEN);
root.setWidth(50f); root.setWidth(50f);
root.setHeight(50f); root.setHeight(50f);
final CSSNode root_child0 = new CSSNode(); final CSSNode root_child0 = new CSSNode();
root_child0.setPositionType(CSSPositionType.ABSOLUTE); root_child0.setPositionType(YogaPositionType.ABSOLUTE);
root_child0.setPosition(CSSEdge.START, 0f); root_child0.setPosition(YogaEdge.START, 0f);
root_child0.setPosition(CSSEdge.TOP, 0f); root_child0.setPosition(YogaEdge.TOP, 0f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child0_child0 = new CSSNode(); final CSSNode root_child0_child0 = new CSSNode();
root_child0_child0.setWidth(100f); root_child0_child0.setWidth(100f);
root_child0_child0.setHeight(100f); root_child0_child0.setHeight(100f);
root_child0.addChildAt(root_child0_child0, 0); root_child0.addChildAt(root_child0_child0, 0);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); 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.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -236,37 +236,37 @@ public class CSSLayoutAbsolutePositionTest {
@Test @Test
public void test_absolute_layout_within_border() { public void test_absolute_layout_within_border() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setMargin(CSSEdge.LEFT, 10f); root.setMargin(YogaEdge.LEFT, 10f);
root.setMargin(CSSEdge.TOP, 10f); root.setMargin(YogaEdge.TOP, 10f);
root.setMargin(CSSEdge.RIGHT, 10f); root.setMargin(YogaEdge.RIGHT, 10f);
root.setMargin(CSSEdge.BOTTOM, 10f); root.setMargin(YogaEdge.BOTTOM, 10f);
root.setPadding(CSSEdge.LEFT, 10); root.setPadding(YogaEdge.LEFT, 10);
root.setPadding(CSSEdge.TOP, 10); root.setPadding(YogaEdge.TOP, 10);
root.setPadding(CSSEdge.RIGHT, 10); root.setPadding(YogaEdge.RIGHT, 10);
root.setPadding(CSSEdge.BOTTOM, 10); root.setPadding(YogaEdge.BOTTOM, 10);
root.setBorder(CSSEdge.LEFT, 10f); root.setBorder(YogaEdge.LEFT, 10f);
root.setBorder(CSSEdge.TOP, 10f); root.setBorder(YogaEdge.TOP, 10f);
root.setBorder(CSSEdge.RIGHT, 10f); root.setBorder(YogaEdge.RIGHT, 10f);
root.setBorder(CSSEdge.BOTTOM, 10f); root.setBorder(YogaEdge.BOTTOM, 10f);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final CSSNode root_child0 = new CSSNode();
root_child0.setPositionType(CSSPositionType.ABSOLUTE); root_child0.setPositionType(YogaPositionType.ABSOLUTE);
root_child0.setPosition(CSSEdge.LEFT, 0f); root_child0.setPosition(YogaEdge.LEFT, 0f);
root_child0.setPosition(CSSEdge.TOP, 0f); root_child0.setPosition(YogaEdge.TOP, 0f);
root_child0.setWidth(50f); root_child0.setWidth(50f);
root_child0.setHeight(50f); root_child0.setHeight(50f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
final CSSNode root_child1 = new CSSNode(); final CSSNode root_child1 = new CSSNode();
root_child1.setPositionType(CSSPositionType.ABSOLUTE); root_child1.setPositionType(YogaPositionType.ABSOLUTE);
root_child1.setPosition(CSSEdge.RIGHT, 0f); root_child1.setPosition(YogaEdge.RIGHT, 0f);
root_child1.setPosition(CSSEdge.BOTTOM, 0f); root_child1.setPosition(YogaEdge.BOTTOM, 0f);
root_child1.setWidth(50f); root_child1.setWidth(50f);
root_child1.setHeight(50f); root_child1.setHeight(50f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(10f, root.getLayoutX(), 0.0f); assertEquals(10f, root.getLayoutX(), 0.0f);
@@ -284,7 +284,7 @@ public class CSSLayoutAbsolutePositionTest {
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(10f, root.getLayoutX(), 0.0f); assertEquals(10f, root.getLayoutX(), 0.0f);

View File

@@ -19,7 +19,7 @@ public class CSSLayoutAlignContentTest {
@Test @Test
public void test_align_content_flex_start() { public void test_align_content_flex_start() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setWrap(CSSWrap.WRAP); root.setWrap(YogaWrap.WRAP);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
@@ -47,7 +47,7 @@ public class CSSLayoutAlignContentTest {
root_child4.setWidth(50f); root_child4.setWidth(50f);
root_child4.setHeight(10f); root_child4.setHeight(10f);
root.addChildAt(root_child4, 4); root.addChildAt(root_child4, 4);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -80,7 +80,7 @@ public class CSSLayoutAlignContentTest {
assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f); assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -117,8 +117,8 @@ public class CSSLayoutAlignContentTest {
@Test @Test
public void test_align_content_flex_end() { public void test_align_content_flex_end() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setAlignContent(CSSAlign.FLEX_END); root.setAlignContent(YogaAlign.FLEX_END);
root.setWrap(CSSWrap.WRAP); root.setWrap(YogaWrap.WRAP);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
@@ -146,7 +146,7 @@ public class CSSLayoutAlignContentTest {
root_child4.setWidth(50f); root_child4.setWidth(50f);
root_child4.setHeight(10f); root_child4.setHeight(10f);
root.addChildAt(root_child4, 4); root.addChildAt(root_child4, 4);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -179,7 +179,7 @@ public class CSSLayoutAlignContentTest {
assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f); assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -216,8 +216,8 @@ public class CSSLayoutAlignContentTest {
@Test @Test
public void test_align_content_center() { public void test_align_content_center() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setAlignContent(CSSAlign.CENTER); root.setAlignContent(YogaAlign.CENTER);
root.setWrap(CSSWrap.WRAP); root.setWrap(YogaWrap.WRAP);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
@@ -245,7 +245,7 @@ public class CSSLayoutAlignContentTest {
root_child4.setWidth(50f); root_child4.setWidth(50f);
root_child4.setHeight(10f); root_child4.setHeight(10f);
root.addChildAt(root_child4, 4); root.addChildAt(root_child4, 4);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -278,7 +278,7 @@ public class CSSLayoutAlignContentTest {
assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child4.getLayoutHeight(), 0.0f); assertEquals(10f, root_child4.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -315,8 +315,8 @@ public class CSSLayoutAlignContentTest {
@Test @Test
public void test_align_content_stretch() { public void test_align_content_stretch() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setAlignContent(CSSAlign.STRETCH); root.setAlignContent(YogaAlign.STRETCH);
root.setWrap(CSSWrap.WRAP); root.setWrap(YogaWrap.WRAP);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
@@ -339,7 +339,7 @@ public class CSSLayoutAlignContentTest {
final CSSNode root_child4 = new CSSNode(); final CSSNode root_child4 = new CSSNode();
root_child4.setWidth(50f); root_child4.setWidth(50f);
root.addChildAt(root_child4, 4); root.addChildAt(root_child4, 4);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -372,7 +372,7 @@ public class CSSLayoutAlignContentTest {
assertEquals(50f, root_child4.getLayoutWidth(), 0.0f); assertEquals(50f, root_child4.getLayoutWidth(), 0.0f);
assertEquals(0f, root_child4.getLayoutHeight(), 0.0f); assertEquals(0f, root_child4.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);

View File

@@ -25,7 +25,7 @@ public class CSSLayoutAlignItemsTest {
final CSSNode root_child0 = new CSSNode(); final CSSNode root_child0 = new CSSNode();
root_child0.setHeight(10f); root_child0.setHeight(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -38,7 +38,7 @@ public class CSSLayoutAlignItemsTest {
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -55,7 +55,7 @@ public class CSSLayoutAlignItemsTest {
@Test @Test
public void test_align_items_center() { public void test_align_items_center() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setAlignItems(CSSAlign.CENTER); root.setAlignItems(YogaAlign.CENTER);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
@@ -63,7 +63,7 @@ public class CSSLayoutAlignItemsTest {
root_child0.setWidth(10f); root_child0.setWidth(10f);
root_child0.setHeight(10f); root_child0.setHeight(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -76,7 +76,7 @@ public class CSSLayoutAlignItemsTest {
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -93,7 +93,7 @@ public class CSSLayoutAlignItemsTest {
@Test @Test
public void test_align_items_flex_start() { public void test_align_items_flex_start() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setAlignItems(CSSAlign.FLEX_START); root.setAlignItems(YogaAlign.FLEX_START);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
@@ -101,7 +101,7 @@ public class CSSLayoutAlignItemsTest {
root_child0.setWidth(10f); root_child0.setWidth(10f);
root_child0.setHeight(10f); root_child0.setHeight(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -114,7 +114,7 @@ public class CSSLayoutAlignItemsTest {
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -131,7 +131,7 @@ public class CSSLayoutAlignItemsTest {
@Test @Test
public void test_align_items_flex_end() { public void test_align_items_flex_end() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setAlignItems(CSSAlign.FLEX_END); root.setAlignItems(YogaAlign.FLEX_END);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
@@ -139,7 +139,7 @@ public class CSSLayoutAlignItemsTest {
root_child0.setWidth(10f); root_child0.setWidth(10f);
root_child0.setHeight(10f); root_child0.setHeight(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -152,7 +152,7 @@ public class CSSLayoutAlignItemsTest {
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);

View File

@@ -23,11 +23,11 @@ public class CSSLayoutAlignSelfTest {
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final CSSNode root_child0 = new CSSNode();
root_child0.setAlignSelf(CSSAlign.CENTER); root_child0.setAlignSelf(YogaAlign.CENTER);
root_child0.setWidth(10f); root_child0.setWidth(10f);
root_child0.setHeight(10f); root_child0.setHeight(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -40,7 +40,7 @@ public class CSSLayoutAlignSelfTest {
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -61,11 +61,11 @@ public class CSSLayoutAlignSelfTest {
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final CSSNode root_child0 = new CSSNode();
root_child0.setAlignSelf(CSSAlign.FLEX_END); root_child0.setAlignSelf(YogaAlign.FLEX_END);
root_child0.setWidth(10f); root_child0.setWidth(10f);
root_child0.setHeight(10f); root_child0.setHeight(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -78,7 +78,7 @@ public class CSSLayoutAlignSelfTest {
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -99,11 +99,11 @@ public class CSSLayoutAlignSelfTest {
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final CSSNode root_child0 = new CSSNode();
root_child0.setAlignSelf(CSSAlign.FLEX_START); root_child0.setAlignSelf(YogaAlign.FLEX_START);
root_child0.setWidth(10f); root_child0.setWidth(10f);
root_child0.setHeight(10f); root_child0.setHeight(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -116,7 +116,7 @@ public class CSSLayoutAlignSelfTest {
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -133,16 +133,16 @@ public class CSSLayoutAlignSelfTest {
@Test @Test
public void test_align_self_flex_end_override_flex_start() { public void test_align_self_flex_end_override_flex_start() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setAlignItems(CSSAlign.FLEX_START); root.setAlignItems(YogaAlign.FLEX_START);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final CSSNode root_child0 = new CSSNode();
root_child0.setAlignSelf(CSSAlign.FLEX_END); root_child0.setAlignSelf(YogaAlign.FLEX_END);
root_child0.setWidth(10f); root_child0.setWidth(10f);
root_child0.setHeight(10f); root_child0.setHeight(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -155,7 +155,7 @@ public class CSSLayoutAlignSelfTest {
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);

View File

@@ -19,11 +19,11 @@ public class CSSLayoutBorderTest {
@Test @Test
public void test_border_no_size() { public void test_border_no_size() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setBorder(CSSEdge.LEFT, 10f); root.setBorder(YogaEdge.LEFT, 10f);
root.setBorder(CSSEdge.TOP, 10f); root.setBorder(YogaEdge.TOP, 10f);
root.setBorder(CSSEdge.RIGHT, 10f); root.setBorder(YogaEdge.RIGHT, 10f);
root.setBorder(CSSEdge.BOTTOM, 10f); root.setBorder(YogaEdge.BOTTOM, 10f);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -31,7 +31,7 @@ public class CSSLayoutBorderTest {
assertEquals(20f, root.getLayoutWidth(), 0.0f); assertEquals(20f, root.getLayoutWidth(), 0.0f);
assertEquals(20f, root.getLayoutHeight(), 0.0f); assertEquals(20f, root.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -43,16 +43,16 @@ public class CSSLayoutBorderTest {
@Test @Test
public void test_border_container_match_child() { public void test_border_container_match_child() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setBorder(CSSEdge.LEFT, 10f); root.setBorder(YogaEdge.LEFT, 10f);
root.setBorder(CSSEdge.TOP, 10f); root.setBorder(YogaEdge.TOP, 10f);
root.setBorder(CSSEdge.RIGHT, 10f); root.setBorder(YogaEdge.RIGHT, 10f);
root.setBorder(CSSEdge.BOTTOM, 10f); root.setBorder(YogaEdge.BOTTOM, 10f);
final CSSNode root_child0 = new CSSNode(); final CSSNode root_child0 = new CSSNode();
root_child0.setWidth(10f); root_child0.setWidth(10f);
root_child0.setHeight(10f); root_child0.setHeight(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -65,7 +65,7 @@ public class CSSLayoutBorderTest {
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -82,10 +82,10 @@ public class CSSLayoutBorderTest {
@Test @Test
public void test_border_flex_child() { public void test_border_flex_child() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setBorder(CSSEdge.LEFT, 10f); root.setBorder(YogaEdge.LEFT, 10f);
root.setBorder(CSSEdge.TOP, 10f); root.setBorder(YogaEdge.TOP, 10f);
root.setBorder(CSSEdge.RIGHT, 10f); root.setBorder(YogaEdge.RIGHT, 10f);
root.setBorder(CSSEdge.BOTTOM, 10f); root.setBorder(YogaEdge.BOTTOM, 10f);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
@@ -93,7 +93,7 @@ public class CSSLayoutBorderTest {
root_child0.setFlexGrow(1f); root_child0.setFlexGrow(1f);
root_child0.setWidth(10f); root_child0.setWidth(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -106,7 +106,7 @@ public class CSSLayoutBorderTest {
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(80f, root_child0.getLayoutHeight(), 0.0f); assertEquals(80f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -123,17 +123,17 @@ public class CSSLayoutBorderTest {
@Test @Test
public void test_border_stretch_child() { public void test_border_stretch_child() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setBorder(CSSEdge.LEFT, 10f); root.setBorder(YogaEdge.LEFT, 10f);
root.setBorder(CSSEdge.TOP, 10f); root.setBorder(YogaEdge.TOP, 10f);
root.setBorder(CSSEdge.RIGHT, 10f); root.setBorder(YogaEdge.RIGHT, 10f);
root.setBorder(CSSEdge.BOTTOM, 10f); root.setBorder(YogaEdge.BOTTOM, 10f);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final CSSNode root_child0 = new CSSNode();
root_child0.setHeight(10f); root_child0.setHeight(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -146,7 +146,7 @@ public class CSSLayoutBorderTest {
assertEquals(80f, root_child0.getLayoutWidth(), 0.0f); assertEquals(80f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -163,11 +163,11 @@ public class CSSLayoutBorderTest {
@Test @Test
public void test_border_center_child() { public void test_border_center_child() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setJustifyContent(CSSJustify.CENTER); root.setJustifyContent(YogaJustify.CENTER);
root.setAlignItems(CSSAlign.CENTER); root.setAlignItems(YogaAlign.CENTER);
root.setBorder(CSSEdge.START, 10f); root.setBorder(YogaEdge.START, 10f);
root.setBorder(CSSEdge.END, 20f); root.setBorder(YogaEdge.END, 20f);
root.setBorder(CSSEdge.BOTTOM, 20f); root.setBorder(YogaEdge.BOTTOM, 20f);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
@@ -175,7 +175,7 @@ public class CSSLayoutBorderTest {
root_child0.setWidth(10f); root_child0.setWidth(10f);
root_child0.setHeight(10f); root_child0.setHeight(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -188,7 +188,7 @@ public class CSSLayoutBorderTest {
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);

View File

@@ -32,7 +32,7 @@ public class CSSLayoutFlexDirectionTest {
final CSSNode root_child2 = new CSSNode(); final CSSNode root_child2 = new CSSNode();
root_child2.setHeight(10f); root_child2.setHeight(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -55,7 +55,7 @@ public class CSSLayoutFlexDirectionTest {
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f); assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -82,7 +82,7 @@ public class CSSLayoutFlexDirectionTest {
@Test @Test
public void test_flex_direction_row_no_width() { public void test_flex_direction_row_no_width() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final CSSNode root_child0 = new CSSNode();
@@ -96,7 +96,7 @@ public class CSSLayoutFlexDirectionTest {
final CSSNode root_child2 = new CSSNode(); final CSSNode root_child2 = new CSSNode();
root_child2.setWidth(10f); root_child2.setWidth(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -119,7 +119,7 @@ public class CSSLayoutFlexDirectionTest {
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -160,7 +160,7 @@ public class CSSLayoutFlexDirectionTest {
final CSSNode root_child2 = new CSSNode(); final CSSNode root_child2 = new CSSNode();
root_child2.setHeight(10f); root_child2.setHeight(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -183,7 +183,7 @@ public class CSSLayoutFlexDirectionTest {
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f); assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -210,7 +210,7 @@ public class CSSLayoutFlexDirectionTest {
@Test @Test
public void test_flex_direction_row() { public void test_flex_direction_row() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
@@ -225,7 +225,7 @@ public class CSSLayoutFlexDirectionTest {
final CSSNode root_child2 = new CSSNode(); final CSSNode root_child2 = new CSSNode();
root_child2.setWidth(10f); root_child2.setWidth(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -248,7 +248,7 @@ public class CSSLayoutFlexDirectionTest {
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -275,7 +275,7 @@ public class CSSLayoutFlexDirectionTest {
@Test @Test
public void test_flex_direction_column_reverse() { public void test_flex_direction_column_reverse() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.COLUMN_REVERSE); root.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
@@ -290,7 +290,7 @@ public class CSSLayoutFlexDirectionTest {
final CSSNode root_child2 = new CSSNode(); final CSSNode root_child2 = new CSSNode();
root_child2.setHeight(10f); root_child2.setHeight(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -313,7 +313,7 @@ public class CSSLayoutFlexDirectionTest {
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f); assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -340,7 +340,7 @@ public class CSSLayoutFlexDirectionTest {
@Test @Test
public void test_flex_direction_row_reverse() { public void test_flex_direction_row_reverse() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW_REVERSE); root.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
@@ -355,7 +355,7 @@ public class CSSLayoutFlexDirectionTest {
final CSSNode root_child2 = new CSSNode(); final CSSNode root_child2 = new CSSNode();
root_child2.setWidth(10f); root_child2.setWidth(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -378,7 +378,7 @@ public class CSSLayoutFlexDirectionTest {
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);

View File

@@ -30,7 +30,7 @@ public class CSSLayoutFlexTest {
final CSSNode root_child1 = new CSSNode(); final CSSNode root_child1 = new CSSNode();
root_child1.setFlexGrow(1f); root_child1.setFlexGrow(1f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -48,7 +48,7 @@ public class CSSLayoutFlexTest {
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(25f, root_child1.getLayoutHeight(), 0.0f); assertEquals(25f, root_child1.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -70,7 +70,7 @@ public class CSSLayoutFlexTest {
@Test @Test
public void test_flex_basis_flex_grow_row() { public void test_flex_basis_flex_grow_row() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
@@ -82,7 +82,7 @@ public class CSSLayoutFlexTest {
final CSSNode root_child1 = new CSSNode(); final CSSNode root_child1 = new CSSNode();
root_child1.setFlexGrow(1f); root_child1.setFlexGrow(1f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -100,7 +100,7 @@ public class CSSLayoutFlexTest {
assertEquals(25f, root_child1.getLayoutWidth(), 0.0f); assertEquals(25f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -133,7 +133,7 @@ public class CSSLayoutFlexTest {
final CSSNode root_child1 = new CSSNode(); final CSSNode root_child1 = new CSSNode();
root_child1.setFlexBasis(50f); root_child1.setFlexBasis(50f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -151,7 +151,7 @@ public class CSSLayoutFlexTest {
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -173,7 +173,7 @@ public class CSSLayoutFlexTest {
@Test @Test
public void test_flex_basis_flex_shrink_row() { public void test_flex_basis_flex_shrink_row() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
@@ -185,7 +185,7 @@ public class CSSLayoutFlexTest {
final CSSNode root_child1 = new CSSNode(); final CSSNode root_child1 = new CSSNode();
root_child1.setFlexBasis(50f); root_child1.setFlexBasis(50f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -203,7 +203,7 @@ public class CSSLayoutFlexTest {
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -242,7 +242,7 @@ public class CSSLayoutFlexTest {
root_child2.setWidth(50f); root_child2.setWidth(50f);
root_child2.setHeight(50f); root_child2.setHeight(50f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -265,7 +265,7 @@ public class CSSLayoutFlexTest {
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f); assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -310,7 +310,7 @@ public class CSSLayoutFlexTest {
root_child2.setFlexGrow(1f); root_child2.setFlexGrow(1f);
root_child2.setHeight(10f); root_child2.setHeight(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -333,7 +333,7 @@ public class CSSLayoutFlexTest {
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child2.getLayoutHeight(), 0.0f); assertEquals(20f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -370,7 +370,7 @@ public class CSSLayoutFlexTest {
root_child0_child0.setFlexGrow(1f); root_child0_child0.setFlexGrow(1f);
root_child0_child0.setFlexShrink(1f); root_child0_child0.setFlexShrink(1f);
root_child0.addChildAt(root_child0_child0, 0); root_child0.addChildAt(root_child0_child0, 0);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -388,7 +388,7 @@ public class CSSLayoutFlexTest {
assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(0f, root_child0_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);

View File

@@ -19,7 +19,7 @@ public class CSSLayoutFlexWrapTest {
@Test @Test
public void test_wrap_column() { public void test_wrap_column() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setWrap(CSSWrap.WRAP); root.setWrap(YogaWrap.WRAP);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final CSSNode root_child0 = new CSSNode();
@@ -41,7 +41,7 @@ public class CSSLayoutFlexWrapTest {
root_child3.setWidth(30f); root_child3.setWidth(30f);
root_child3.setHeight(30f); root_child3.setHeight(30f);
root.addChildAt(root_child3, 3); root.addChildAt(root_child3, 3);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -69,7 +69,7 @@ public class CSSLayoutFlexWrapTest {
assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); assertEquals(30f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child3.getLayoutHeight(), 0.0f); assertEquals(30f, root_child3.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -101,8 +101,8 @@ public class CSSLayoutFlexWrapTest {
@Test @Test
public void test_wrap_row() { public void test_wrap_row() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setWrap(CSSWrap.WRAP); root.setWrap(YogaWrap.WRAP);
root.setWidth(100f); root.setWidth(100f);
final CSSNode root_child0 = new CSSNode(); final CSSNode root_child0 = new CSSNode();
@@ -124,7 +124,7 @@ public class CSSLayoutFlexWrapTest {
root_child3.setWidth(30f); root_child3.setWidth(30f);
root_child3.setHeight(30f); root_child3.setHeight(30f);
root.addChildAt(root_child3, 3); root.addChildAt(root_child3, 3);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -152,7 +152,7 @@ public class CSSLayoutFlexWrapTest {
assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); assertEquals(30f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child3.getLayoutHeight(), 0.0f); assertEquals(30f, root_child3.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -184,9 +184,9 @@ public class CSSLayoutFlexWrapTest {
@Test @Test
public void test_wrap_row_align_items_flex_end() { public void test_wrap_row_align_items_flex_end() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setAlignItems(CSSAlign.FLEX_END); root.setAlignItems(YogaAlign.FLEX_END);
root.setWrap(CSSWrap.WRAP); root.setWrap(YogaWrap.WRAP);
root.setWidth(100f); root.setWidth(100f);
final CSSNode root_child0 = new CSSNode(); final CSSNode root_child0 = new CSSNode();
@@ -208,7 +208,7 @@ public class CSSLayoutFlexWrapTest {
root_child3.setWidth(30f); root_child3.setWidth(30f);
root_child3.setHeight(30f); root_child3.setHeight(30f);
root.addChildAt(root_child3, 3); root.addChildAt(root_child3, 3);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -236,7 +236,7 @@ public class CSSLayoutFlexWrapTest {
assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); assertEquals(30f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child3.getLayoutHeight(), 0.0f); assertEquals(30f, root_child3.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -268,9 +268,9 @@ public class CSSLayoutFlexWrapTest {
@Test @Test
public void test_wrap_row_align_items_center() { public void test_wrap_row_align_items_center() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setAlignItems(CSSAlign.CENTER); root.setAlignItems(YogaAlign.CENTER);
root.setWrap(CSSWrap.WRAP); root.setWrap(YogaWrap.WRAP);
root.setWidth(100f); root.setWidth(100f);
final CSSNode root_child0 = new CSSNode(); final CSSNode root_child0 = new CSSNode();
@@ -292,7 +292,7 @@ public class CSSLayoutFlexWrapTest {
root_child3.setWidth(30f); root_child3.setWidth(30f);
root_child3.setHeight(30f); root_child3.setHeight(30f);
root.addChildAt(root_child3, 3); root.addChildAt(root_child3, 3);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -320,7 +320,7 @@ public class CSSLayoutFlexWrapTest {
assertEquals(30f, root_child3.getLayoutWidth(), 0.0f); assertEquals(30f, root_child3.getLayoutWidth(), 0.0f);
assertEquals(30f, root_child3.getLayoutHeight(), 0.0f); assertEquals(30f, root_child3.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);

View File

@@ -19,7 +19,7 @@ public class CSSLayoutJustifyContentTest {
@Test @Test
public void test_justify_content_row_flex_start() { public void test_justify_content_row_flex_start() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setWidth(102f); root.setWidth(102f);
root.setHeight(102f); root.setHeight(102f);
@@ -34,7 +34,7 @@ public class CSSLayoutJustifyContentTest {
final CSSNode root_child2 = new CSSNode(); final CSSNode root_child2 = new CSSNode();
root_child2.setWidth(10f); root_child2.setWidth(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -57,7 +57,7 @@ public class CSSLayoutJustifyContentTest {
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f); assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -84,8 +84,8 @@ public class CSSLayoutJustifyContentTest {
@Test @Test
public void test_justify_content_row_flex_end() { public void test_justify_content_row_flex_end() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setJustifyContent(CSSJustify.FLEX_END); root.setJustifyContent(YogaJustify.FLEX_END);
root.setWidth(102f); root.setWidth(102f);
root.setHeight(102f); root.setHeight(102f);
@@ -100,7 +100,7 @@ public class CSSLayoutJustifyContentTest {
final CSSNode root_child2 = new CSSNode(); final CSSNode root_child2 = new CSSNode();
root_child2.setWidth(10f); root_child2.setWidth(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -123,7 +123,7 @@ public class CSSLayoutJustifyContentTest {
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f); assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -150,8 +150,8 @@ public class CSSLayoutJustifyContentTest {
@Test @Test
public void test_justify_content_row_center() { public void test_justify_content_row_center() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setJustifyContent(CSSJustify.CENTER); root.setJustifyContent(YogaJustify.CENTER);
root.setWidth(102f); root.setWidth(102f);
root.setHeight(102f); root.setHeight(102f);
@@ -166,7 +166,7 @@ public class CSSLayoutJustifyContentTest {
final CSSNode root_child2 = new CSSNode(); final CSSNode root_child2 = new CSSNode();
root_child2.setWidth(10f); root_child2.setWidth(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -189,7 +189,7 @@ public class CSSLayoutJustifyContentTest {
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f); assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -216,8 +216,8 @@ public class CSSLayoutJustifyContentTest {
@Test @Test
public void test_justify_content_row_space_between() { public void test_justify_content_row_space_between() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setJustifyContent(CSSJustify.SPACE_BETWEEN); root.setJustifyContent(YogaJustify.SPACE_BETWEEN);
root.setWidth(102f); root.setWidth(102f);
root.setHeight(102f); root.setHeight(102f);
@@ -232,7 +232,7 @@ public class CSSLayoutJustifyContentTest {
final CSSNode root_child2 = new CSSNode(); final CSSNode root_child2 = new CSSNode();
root_child2.setWidth(10f); root_child2.setWidth(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -255,7 +255,7 @@ public class CSSLayoutJustifyContentTest {
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f); assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -282,8 +282,8 @@ public class CSSLayoutJustifyContentTest {
@Test @Test
public void test_justify_content_row_space_around() { public void test_justify_content_row_space_around() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setJustifyContent(CSSJustify.SPACE_AROUND); root.setJustifyContent(YogaJustify.SPACE_AROUND);
root.setWidth(102f); root.setWidth(102f);
root.setHeight(102f); root.setHeight(102f);
@@ -298,7 +298,7 @@ public class CSSLayoutJustifyContentTest {
final CSSNode root_child2 = new CSSNode(); final CSSNode root_child2 = new CSSNode();
root_child2.setWidth(10f); root_child2.setWidth(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -321,7 +321,7 @@ public class CSSLayoutJustifyContentTest {
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f); assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(102f, root_child2.getLayoutHeight(), 0.0f); assertEquals(102f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -361,7 +361,7 @@ public class CSSLayoutJustifyContentTest {
final CSSNode root_child2 = new CSSNode(); final CSSNode root_child2 = new CSSNode();
root_child2.setHeight(10f); root_child2.setHeight(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -384,7 +384,7 @@ public class CSSLayoutJustifyContentTest {
assertEquals(102f, root_child2.getLayoutWidth(), 0.0f); assertEquals(102f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f); assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -411,7 +411,7 @@ public class CSSLayoutJustifyContentTest {
@Test @Test
public void test_justify_content_column_flex_end() { public void test_justify_content_column_flex_end() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setJustifyContent(CSSJustify.FLEX_END); root.setJustifyContent(YogaJustify.FLEX_END);
root.setWidth(102f); root.setWidth(102f);
root.setHeight(102f); root.setHeight(102f);
@@ -426,7 +426,7 @@ public class CSSLayoutJustifyContentTest {
final CSSNode root_child2 = new CSSNode(); final CSSNode root_child2 = new CSSNode();
root_child2.setHeight(10f); root_child2.setHeight(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -449,7 +449,7 @@ public class CSSLayoutJustifyContentTest {
assertEquals(102f, root_child2.getLayoutWidth(), 0.0f); assertEquals(102f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f); assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -476,7 +476,7 @@ public class CSSLayoutJustifyContentTest {
@Test @Test
public void test_justify_content_column_center() { public void test_justify_content_column_center() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setJustifyContent(CSSJustify.CENTER); root.setJustifyContent(YogaJustify.CENTER);
root.setWidth(102f); root.setWidth(102f);
root.setHeight(102f); root.setHeight(102f);
@@ -491,7 +491,7 @@ public class CSSLayoutJustifyContentTest {
final CSSNode root_child2 = new CSSNode(); final CSSNode root_child2 = new CSSNode();
root_child2.setHeight(10f); root_child2.setHeight(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -514,7 +514,7 @@ public class CSSLayoutJustifyContentTest {
assertEquals(102f, root_child2.getLayoutWidth(), 0.0f); assertEquals(102f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f); assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -541,7 +541,7 @@ public class CSSLayoutJustifyContentTest {
@Test @Test
public void test_justify_content_column_space_between() { public void test_justify_content_column_space_between() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setJustifyContent(CSSJustify.SPACE_BETWEEN); root.setJustifyContent(YogaJustify.SPACE_BETWEEN);
root.setWidth(102f); root.setWidth(102f);
root.setHeight(102f); root.setHeight(102f);
@@ -556,7 +556,7 @@ public class CSSLayoutJustifyContentTest {
final CSSNode root_child2 = new CSSNode(); final CSSNode root_child2 = new CSSNode();
root_child2.setHeight(10f); root_child2.setHeight(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -579,7 +579,7 @@ public class CSSLayoutJustifyContentTest {
assertEquals(102f, root_child2.getLayoutWidth(), 0.0f); assertEquals(102f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f); assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -606,7 +606,7 @@ public class CSSLayoutJustifyContentTest {
@Test @Test
public void test_justify_content_column_space_around() { public void test_justify_content_column_space_around() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setJustifyContent(CSSJustify.SPACE_AROUND); root.setJustifyContent(YogaJustify.SPACE_AROUND);
root.setWidth(102f); root.setWidth(102f);
root.setHeight(102f); root.setHeight(102f);
@@ -621,7 +621,7 @@ public class CSSLayoutJustifyContentTest {
final CSSNode root_child2 = new CSSNode(); final CSSNode root_child2 = new CSSNode();
root_child2.setHeight(10f); root_child2.setHeight(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -644,7 +644,7 @@ public class CSSLayoutJustifyContentTest {
assertEquals(102f, root_child2.getLayoutWidth(), 0.0f); assertEquals(102f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child2.getLayoutHeight(), 0.0f); assertEquals(10f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);

View File

@@ -19,15 +19,15 @@ public class CSSLayoutMarginTest {
@Test @Test
public void test_margin_start() { public void test_margin_start() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final CSSNode root_child0 = new CSSNode();
root_child0.setMargin(CSSEdge.START, 10f); root_child0.setMargin(YogaEdge.START, 10f);
root_child0.setWidth(10f); root_child0.setWidth(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -40,7 +40,7 @@ public class CSSLayoutMarginTest {
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -61,10 +61,10 @@ public class CSSLayoutMarginTest {
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final CSSNode root_child0 = new CSSNode();
root_child0.setMargin(CSSEdge.TOP, 10f); root_child0.setMargin(YogaEdge.TOP, 10f);
root_child0.setHeight(10f); root_child0.setHeight(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -77,7 +77,7 @@ public class CSSLayoutMarginTest {
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -94,16 +94,16 @@ public class CSSLayoutMarginTest {
@Test @Test
public void test_margin_end() { public void test_margin_end() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setJustifyContent(CSSJustify.FLEX_END); root.setJustifyContent(YogaJustify.FLEX_END);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final CSSNode root_child0 = new CSSNode();
root_child0.setMargin(CSSEdge.END, 10f); root_child0.setMargin(YogaEdge.END, 10f);
root_child0.setWidth(10f); root_child0.setWidth(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -116,7 +116,7 @@ public class CSSLayoutMarginTest {
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -133,15 +133,15 @@ public class CSSLayoutMarginTest {
@Test @Test
public void test_margin_bottom() { public void test_margin_bottom() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setJustifyContent(CSSJustify.FLEX_END); root.setJustifyContent(YogaJustify.FLEX_END);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final CSSNode root_child0 = new CSSNode();
root_child0.setMargin(CSSEdge.BOTTOM, 10f); root_child0.setMargin(YogaEdge.BOTTOM, 10f);
root_child0.setHeight(10f); root_child0.setHeight(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -154,7 +154,7 @@ public class CSSLayoutMarginTest {
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -171,15 +171,15 @@ public class CSSLayoutMarginTest {
@Test @Test
public void test_margin_and_flex_row() { public void test_margin_and_flex_row() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1f); root_child0.setFlexGrow(1f);
root_child0.setMargin(CSSEdge.START, 10f); root_child0.setMargin(YogaEdge.START, 10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -192,7 +192,7 @@ public class CSSLayoutMarginTest {
assertEquals(90f, root_child0.getLayoutWidth(), 0.0f); assertEquals(90f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -214,9 +214,9 @@ public class CSSLayoutMarginTest {
final CSSNode root_child0 = new CSSNode(); final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1f); root_child0.setFlexGrow(1f);
root_child0.setMargin(CSSEdge.TOP, 10f); root_child0.setMargin(YogaEdge.TOP, 10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -229,7 +229,7 @@ public class CSSLayoutMarginTest {
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(90f, root_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -246,15 +246,15 @@ public class CSSLayoutMarginTest {
@Test @Test
public void test_margin_and_stretch_row() { public void test_margin_and_stretch_row() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1f); root_child0.setFlexGrow(1f);
root_child0.setMargin(CSSEdge.TOP, 10f); root_child0.setMargin(YogaEdge.TOP, 10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -267,7 +267,7 @@ public class CSSLayoutMarginTest {
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(90f, root_child0.getLayoutHeight(), 0.0f); assertEquals(90f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -289,9 +289,9 @@ public class CSSLayoutMarginTest {
final CSSNode root_child0 = new CSSNode(); final CSSNode root_child0 = new CSSNode();
root_child0.setFlexGrow(1f); root_child0.setFlexGrow(1f);
root_child0.setMargin(CSSEdge.START, 10f); root_child0.setMargin(YogaEdge.START, 10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -304,7 +304,7 @@ public class CSSLayoutMarginTest {
assertEquals(90f, root_child0.getLayoutWidth(), 0.0f); assertEquals(90f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -321,7 +321,7 @@ public class CSSLayoutMarginTest {
@Test @Test
public void test_margin_with_sibling_row() { public void test_margin_with_sibling_row() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
@@ -332,7 +332,7 @@ public class CSSLayoutMarginTest {
final CSSNode root_child1 = new CSSNode(); final CSSNode root_child1 = new CSSNode();
root_child1.setFlexGrow(1f); root_child1.setFlexGrow(1f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -350,7 +350,7 @@ public class CSSLayoutMarginTest {
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f); assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -382,7 +382,7 @@ public class CSSLayoutMarginTest {
final CSSNode root_child1 = new CSSNode(); final CSSNode root_child1 = new CSSNode();
root_child1.setFlexGrow(1f); root_child1.setFlexGrow(1f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -400,7 +400,7 @@ public class CSSLayoutMarginTest {
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f); assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);

View File

@@ -26,7 +26,7 @@ public class CSSLayoutMinMaxDimensionTest {
root_child0.setMaxWidth(50f); root_child0.setMaxWidth(50f);
root_child0.setHeight(10f); root_child0.setHeight(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -39,7 +39,7 @@ public class CSSLayoutMinMaxDimensionTest {
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f); assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -56,7 +56,7 @@ public class CSSLayoutMinMaxDimensionTest {
@Test @Test
public void test_max_height() { public void test_max_height() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
@@ -64,7 +64,7 @@ public class CSSLayoutMinMaxDimensionTest {
root_child0.setWidth(10f); root_child0.setWidth(10f);
root_child0.setMaxHeight(50f); root_child0.setMaxHeight(50f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -77,7 +77,7 @@ public class CSSLayoutMinMaxDimensionTest {
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -105,7 +105,7 @@ public class CSSLayoutMinMaxDimensionTest {
final CSSNode root_child1 = new CSSNode(); final CSSNode root_child1 = new CSSNode();
root_child1.setFlexGrow(1f); root_child1.setFlexGrow(1f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -123,7 +123,7 @@ public class CSSLayoutMinMaxDimensionTest {
assertEquals(100f, root_child1.getLayoutWidth(), 0.0f); assertEquals(100f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child1.getLayoutHeight(), 0.0f); assertEquals(20f, root_child1.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -145,7 +145,7 @@ public class CSSLayoutMinMaxDimensionTest {
@Test @Test
public void test_min_width() { public void test_min_width() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
@@ -157,7 +157,7 @@ public class CSSLayoutMinMaxDimensionTest {
final CSSNode root_child1 = new CSSNode(); final CSSNode root_child1 = new CSSNode();
root_child1.setFlexGrow(1f); root_child1.setFlexGrow(1f);
root.addChildAt(root_child1, 1); root.addChildAt(root_child1, 1);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -175,7 +175,7 @@ public class CSSLayoutMinMaxDimensionTest {
assertEquals(20f, root_child1.getLayoutWidth(), 0.0f); assertEquals(20f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f); assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -197,7 +197,7 @@ public class CSSLayoutMinMaxDimensionTest {
@Test @Test
public void test_justify_content_min_max() { public void test_justify_content_min_max() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setJustifyContent(CSSJustify.CENTER); root.setJustifyContent(YogaJustify.CENTER);
root.setWidth(100f); root.setWidth(100f);
root.setMinHeight(100f); root.setMinHeight(100f);
root.setMaxHeight(200f); root.setMaxHeight(200f);
@@ -206,7 +206,7 @@ public class CSSLayoutMinMaxDimensionTest {
root_child0.setWidth(60f); root_child0.setWidth(60f);
root_child0.setHeight(60f); root_child0.setHeight(60f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -219,7 +219,7 @@ public class CSSLayoutMinMaxDimensionTest {
assertEquals(60f, root_child0.getLayoutWidth(), 0.0f); assertEquals(60f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(60f, root_child0.getLayoutHeight(), 0.0f); assertEquals(60f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -236,7 +236,7 @@ public class CSSLayoutMinMaxDimensionTest {
@Test @Test
public void test_align_items_min_max() { public void test_align_items_min_max() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setAlignItems(CSSAlign.CENTER); root.setAlignItems(YogaAlign.CENTER);
root.setMinWidth(100f); root.setMinWidth(100f);
root.setMaxWidth(200f); root.setMaxWidth(200f);
root.setHeight(100f); root.setHeight(100f);
@@ -245,7 +245,7 @@ public class CSSLayoutMinMaxDimensionTest {
root_child0.setWidth(60f); root_child0.setWidth(60f);
root_child0.setHeight(60f); root_child0.setHeight(60f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -258,7 +258,7 @@ public class CSSLayoutMinMaxDimensionTest {
assertEquals(60f, root_child0.getLayoutWidth(), 0.0f); assertEquals(60f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(60f, root_child0.getLayoutHeight(), 0.0f); assertEquals(60f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -275,7 +275,7 @@ public class CSSLayoutMinMaxDimensionTest {
@Test @Test
public void test_justify_content_overflow_min_max() { public void test_justify_content_overflow_min_max() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setJustifyContent(CSSJustify.CENTER); root.setJustifyContent(YogaJustify.CENTER);
root.setMinHeight(100f); root.setMinHeight(100f);
root.setMaxHeight(110f); root.setMaxHeight(110f);
@@ -293,7 +293,7 @@ public class CSSLayoutMinMaxDimensionTest {
root_child2.setWidth(50f); root_child2.setWidth(50f);
root_child2.setHeight(50f); root_child2.setHeight(50f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -316,7 +316,7 @@ public class CSSLayoutMinMaxDimensionTest {
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f); assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f); assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -347,7 +347,7 @@ public class CSSLayoutMinMaxDimensionTest {
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final CSSNode root_child0 = new CSSNode();
root_child0.setFlexDirection(CSSFlexDirection.ROW); root_child0.setFlexDirection(YogaFlexDirection.ROW);
root_child0.setMaxWidth(100f); root_child0.setMaxWidth(100f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
@@ -355,7 +355,7 @@ public class CSSLayoutMinMaxDimensionTest {
root_child0_child0.setFlexGrow(1f); root_child0_child0.setFlexGrow(1f);
root_child0_child0.setHeight(20f); root_child0_child0.setHeight(20f);
root_child0.addChildAt(root_child0_child0, 0); root_child0.addChildAt(root_child0_child0, 0);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -373,7 +373,7 @@ public class CSSLayoutMinMaxDimensionTest {
assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -399,7 +399,7 @@ public class CSSLayoutMinMaxDimensionTest {
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final CSSNode root_child0 = new CSSNode();
root_child0.setFlexDirection(CSSFlexDirection.ROW); root_child0.setFlexDirection(YogaFlexDirection.ROW);
root_child0.setMaxWidth(300f); root_child0.setMaxWidth(300f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
@@ -407,7 +407,7 @@ public class CSSLayoutMinMaxDimensionTest {
root_child0_child0.setFlexGrow(1f); root_child0_child0.setFlexGrow(1f);
root_child0_child0.setHeight(20f); root_child0_child0.setHeight(20f);
root_child0.addChildAt(root_child0_child0, 0); root_child0.addChildAt(root_child0_child0, 0);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -425,7 +425,7 @@ public class CSSLayoutMinMaxDimensionTest {
assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f); assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f); assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);

View File

@@ -19,11 +19,11 @@ public class CSSLayoutPaddingTest {
@Test @Test
public void test_padding_no_size() { public void test_padding_no_size() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setPadding(CSSEdge.LEFT, 10); root.setPadding(YogaEdge.LEFT, 10);
root.setPadding(CSSEdge.TOP, 10); root.setPadding(YogaEdge.TOP, 10);
root.setPadding(CSSEdge.RIGHT, 10); root.setPadding(YogaEdge.RIGHT, 10);
root.setPadding(CSSEdge.BOTTOM, 10); root.setPadding(YogaEdge.BOTTOM, 10);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -31,7 +31,7 @@ public class CSSLayoutPaddingTest {
assertEquals(20f, root.getLayoutWidth(), 0.0f); assertEquals(20f, root.getLayoutWidth(), 0.0f);
assertEquals(20f, root.getLayoutHeight(), 0.0f); assertEquals(20f, root.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -43,16 +43,16 @@ public class CSSLayoutPaddingTest {
@Test @Test
public void test_padding_container_match_child() { public void test_padding_container_match_child() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setPadding(CSSEdge.LEFT, 10); root.setPadding(YogaEdge.LEFT, 10);
root.setPadding(CSSEdge.TOP, 10); root.setPadding(YogaEdge.TOP, 10);
root.setPadding(CSSEdge.RIGHT, 10); root.setPadding(YogaEdge.RIGHT, 10);
root.setPadding(CSSEdge.BOTTOM, 10); root.setPadding(YogaEdge.BOTTOM, 10);
final CSSNode root_child0 = new CSSNode(); final CSSNode root_child0 = new CSSNode();
root_child0.setWidth(10f); root_child0.setWidth(10f);
root_child0.setHeight(10f); root_child0.setHeight(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -65,7 +65,7 @@ public class CSSLayoutPaddingTest {
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -82,10 +82,10 @@ public class CSSLayoutPaddingTest {
@Test @Test
public void test_padding_flex_child() { public void test_padding_flex_child() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setPadding(CSSEdge.LEFT, 10); root.setPadding(YogaEdge.LEFT, 10);
root.setPadding(CSSEdge.TOP, 10); root.setPadding(YogaEdge.TOP, 10);
root.setPadding(CSSEdge.RIGHT, 10); root.setPadding(YogaEdge.RIGHT, 10);
root.setPadding(CSSEdge.BOTTOM, 10); root.setPadding(YogaEdge.BOTTOM, 10);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
@@ -93,7 +93,7 @@ public class CSSLayoutPaddingTest {
root_child0.setFlexGrow(1f); root_child0.setFlexGrow(1f);
root_child0.setWidth(10f); root_child0.setWidth(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -106,7 +106,7 @@ public class CSSLayoutPaddingTest {
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(80f, root_child0.getLayoutHeight(), 0.0f); assertEquals(80f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -123,17 +123,17 @@ public class CSSLayoutPaddingTest {
@Test @Test
public void test_padding_stretch_child() { public void test_padding_stretch_child() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setPadding(CSSEdge.LEFT, 10); root.setPadding(YogaEdge.LEFT, 10);
root.setPadding(CSSEdge.TOP, 10); root.setPadding(YogaEdge.TOP, 10);
root.setPadding(CSSEdge.RIGHT, 10); root.setPadding(YogaEdge.RIGHT, 10);
root.setPadding(CSSEdge.BOTTOM, 10); root.setPadding(YogaEdge.BOTTOM, 10);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
final CSSNode root_child0 = new CSSNode(); final CSSNode root_child0 = new CSSNode();
root_child0.setHeight(10f); root_child0.setHeight(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -146,7 +146,7 @@ public class CSSLayoutPaddingTest {
assertEquals(80f, root_child0.getLayoutWidth(), 0.0f); assertEquals(80f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -163,11 +163,11 @@ public class CSSLayoutPaddingTest {
@Test @Test
public void test_padding_center_child() { public void test_padding_center_child() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setJustifyContent(CSSJustify.CENTER); root.setJustifyContent(YogaJustify.CENTER);
root.setAlignItems(CSSAlign.CENTER); root.setAlignItems(YogaAlign.CENTER);
root.setPadding(CSSEdge.START, 10); root.setPadding(YogaEdge.START, 10);
root.setPadding(CSSEdge.END, 20); root.setPadding(YogaEdge.END, 20);
root.setPadding(CSSEdge.BOTTOM, 20); root.setPadding(YogaEdge.BOTTOM, 20);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
@@ -175,7 +175,7 @@ public class CSSLayoutPaddingTest {
root_child0.setWidth(10f); root_child0.setWidth(10f);
root_child0.setHeight(10f); root_child0.setHeight(10f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -188,7 +188,7 @@ public class CSSLayoutPaddingTest {
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f); assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -205,20 +205,20 @@ public class CSSLayoutPaddingTest {
@Test @Test
public void test_child_with_padding_align_end() { public void test_child_with_padding_align_end() {
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setJustifyContent(CSSJustify.FLEX_END); root.setJustifyContent(YogaJustify.FLEX_END);
root.setAlignItems(CSSAlign.FLEX_END); root.setAlignItems(YogaAlign.FLEX_END);
root.setWidth(200f); root.setWidth(200f);
root.setHeight(200f); root.setHeight(200f);
final CSSNode root_child0 = new CSSNode(); final CSSNode root_child0 = new CSSNode();
root_child0.setPadding(CSSEdge.LEFT, 20); root_child0.setPadding(YogaEdge.LEFT, 20);
root_child0.setPadding(CSSEdge.TOP, 20); root_child0.setPadding(YogaEdge.TOP, 20);
root_child0.setPadding(CSSEdge.RIGHT, 20); root_child0.setPadding(YogaEdge.RIGHT, 20);
root_child0.setPadding(CSSEdge.BOTTOM, 20); root_child0.setPadding(YogaEdge.BOTTOM, 20);
root_child0.setWidth(100f); root_child0.setWidth(100f);
root_child0.setHeight(100f); root_child0.setHeight(100f);
root.addChildAt(root_child0, 0); root.addChildAt(root_child0, 0);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -231,7 +231,7 @@ public class CSSLayoutPaddingTest {
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f); assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f); assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);

View File

@@ -18,10 +18,10 @@ import static org.junit.Assert.assertEquals;
public class CSSLayoutRoundingTest { public class CSSLayoutRoundingTest {
@Test @Test
public void test_rounding_flex_basis_flex_grow_row_width_of_100() { 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(); final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(100f); root.setHeight(100f);
@@ -36,7 +36,7 @@ public class CSSLayoutRoundingTest {
final CSSNode root_child2 = new CSSNode(); final CSSNode root_child2 = new CSSNode();
root_child2.setFlexGrow(1f); root_child2.setFlexGrow(1f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -59,7 +59,7 @@ public class CSSLayoutRoundingTest {
assertEquals(33f, root_child2.getLayoutWidth(), 0.0f); assertEquals(33f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -82,15 +82,15 @@ public class CSSLayoutRoundingTest {
assertEquals(33f, root_child2.getLayoutWidth(), 0.0f); assertEquals(33f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false); CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false);
} }
@Test @Test
public void test_rounding_flex_basis_flex_grow_row_prime_number_width() { 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(); final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setWidth(113f); root.setWidth(113f);
root.setHeight(100f); root.setHeight(100f);
@@ -113,7 +113,7 @@ public class CSSLayoutRoundingTest {
final CSSNode root_child4 = new CSSNode(); final CSSNode root_child4 = new CSSNode();
root_child4.setFlexGrow(1f); root_child4.setFlexGrow(1f);
root.addChildAt(root_child4, 4); root.addChildAt(root_child4, 4);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -146,7 +146,7 @@ public class CSSLayoutRoundingTest {
assertEquals(23f, root_child4.getLayoutWidth(), 0.0f); assertEquals(23f, root_child4.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child4.getLayoutHeight(), 0.0f); assertEquals(100f, root_child4.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -179,15 +179,15 @@ public class CSSLayoutRoundingTest {
assertEquals(23f, root_child4.getLayoutWidth(), 0.0f); assertEquals(23f, root_child4.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child4.getLayoutHeight(), 0.0f); assertEquals(100f, root_child4.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false); CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false);
} }
@Test @Test
public void test_rounding_flex_basis_flex_shrink_row() { public void test_rounding_flex_basis_flex_shrink_row() {
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true); CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setFlexDirection(CSSFlexDirection.ROW); root.setFlexDirection(YogaFlexDirection.ROW);
root.setWidth(101f); root.setWidth(101f);
root.setHeight(100f); root.setHeight(100f);
@@ -203,7 +203,7 @@ public class CSSLayoutRoundingTest {
final CSSNode root_child2 = new CSSNode(); final CSSNode root_child2 = new CSSNode();
root_child2.setFlexBasis(25f); root_child2.setFlexBasis(25f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -226,7 +226,7 @@ public class CSSLayoutRoundingTest {
assertEquals(25f, root_child2.getLayoutWidth(), 0.0f); assertEquals(25f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -249,12 +249,12 @@ public class CSSLayoutRoundingTest {
assertEquals(25f, root_child2.getLayoutWidth(), 0.0f); assertEquals(25f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f); assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false); CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false);
} }
@Test @Test
public void test_rounding_flex_basis_overrides_main_size() { public void test_rounding_flex_basis_overrides_main_size() {
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true); CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setWidth(100f); root.setWidth(100f);
@@ -275,7 +275,7 @@ public class CSSLayoutRoundingTest {
root_child2.setFlexGrow(1f); root_child2.setFlexGrow(1f);
root_child2.setHeight(10f); root_child2.setHeight(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -298,7 +298,7 @@ public class CSSLayoutRoundingTest {
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f); assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -321,12 +321,12 @@ public class CSSLayoutRoundingTest {
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f); assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false); CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false);
} }
@Test @Test
public void test_rounding_total_fractial() { public void test_rounding_total_fractial() {
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true); CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setWidth(87.4f); root.setWidth(87.4f);
@@ -347,7 +347,7 @@ public class CSSLayoutRoundingTest {
root_child2.setFlexGrow(1.1f); root_child2.setFlexGrow(1.1f);
root_child2.setHeight(10.7f); root_child2.setHeight(10.7f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -370,7 +370,7 @@ public class CSSLayoutRoundingTest {
assertEquals(87f, root_child2.getLayoutWidth(), 0.0f); assertEquals(87f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f); assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -393,12 +393,12 @@ public class CSSLayoutRoundingTest {
assertEquals(87f, root_child2.getLayoutWidth(), 0.0f); assertEquals(87f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f); assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false); CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false);
} }
@Test @Test
public void test_rounding_total_fractial_nested() { public void test_rounding_total_fractial_nested() {
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true); CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setWidth(87.4f); root.setWidth(87.4f);
@@ -413,14 +413,14 @@ public class CSSLayoutRoundingTest {
final CSSNode root_child0_child0 = new CSSNode(); final CSSNode root_child0_child0 = new CSSNode();
root_child0_child0.setFlexGrow(1f); root_child0_child0.setFlexGrow(1f);
root_child0_child0.setFlexBasis(0.3f); 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_child0.setHeight(9.9f);
root_child0.addChildAt(root_child0_child0, 0); root_child0.addChildAt(root_child0_child0, 0);
final CSSNode root_child0_child1 = new CSSNode(); final CSSNode root_child0_child1 = new CSSNode();
root_child0_child1.setFlexGrow(4f); root_child0_child1.setFlexGrow(4f);
root_child0_child1.setFlexBasis(0.3f); 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_child1.setHeight(1.1f);
root_child0.addChildAt(root_child0_child1, 1); root_child0.addChildAt(root_child0_child1, 1);
@@ -433,7 +433,7 @@ public class CSSLayoutRoundingTest {
root_child2.setFlexGrow(1.1f); root_child2.setFlexGrow(1.1f);
root_child2.setHeight(10.7f); root_child2.setHeight(10.7f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -466,7 +466,7 @@ public class CSSLayoutRoundingTest {
assertEquals(87f, root_child2.getLayoutWidth(), 0.0f); assertEquals(87f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f); assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -499,12 +499,12 @@ public class CSSLayoutRoundingTest {
assertEquals(87f, root_child2.getLayoutWidth(), 0.0f); assertEquals(87f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f); assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false); CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false);
} }
@Test @Test
public void test_rounding_fractial_input_1() { public void test_rounding_fractial_input_1() {
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true); CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setWidth(100f); root.setWidth(100f);
@@ -525,7 +525,7 @@ public class CSSLayoutRoundingTest {
root_child2.setFlexGrow(1f); root_child2.setFlexGrow(1f);
root_child2.setHeight(10f); root_child2.setHeight(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -548,7 +548,7 @@ public class CSSLayoutRoundingTest {
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f); assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -571,12 +571,12 @@ public class CSSLayoutRoundingTest {
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f); assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false); CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false);
} }
@Test @Test
public void test_rounding_fractial_input_2() { public void test_rounding_fractial_input_2() {
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true); CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setWidth(100f); root.setWidth(100f);
@@ -597,7 +597,7 @@ public class CSSLayoutRoundingTest {
root_child2.setFlexGrow(1f); root_child2.setFlexGrow(1f);
root_child2.setHeight(10f); root_child2.setHeight(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -620,7 +620,7 @@ public class CSSLayoutRoundingTest {
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(25f, root_child2.getLayoutHeight(), 0.0f); assertEquals(25f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -643,15 +643,15 @@ public class CSSLayoutRoundingTest {
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(25f, root_child2.getLayoutHeight(), 0.0f); assertEquals(25f, root_child2.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false); CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false);
} }
@Test @Test
public void test_rounding_fractial_input_3() { public void test_rounding_fractial_input_3() {
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true); CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setPosition(CSSEdge.TOP, 0.3f); root.setPosition(YogaEdge.TOP, 0.3f);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(113.4f); root.setHeight(113.4f);
@@ -670,7 +670,7 @@ public class CSSLayoutRoundingTest {
root_child2.setFlexGrow(1f); root_child2.setFlexGrow(1f);
root_child2.setHeight(10f); root_child2.setHeight(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -693,7 +693,7 @@ public class CSSLayoutRoundingTest {
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f); assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -716,15 +716,15 @@ public class CSSLayoutRoundingTest {
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f); assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false); CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false);
} }
@Test @Test
public void test_rounding_fractial_input_4() { public void test_rounding_fractial_input_4() {
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, true); CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, true);
final CSSNode root = new CSSNode(); final CSSNode root = new CSSNode();
root.setPosition(CSSEdge.TOP, 0.7f); root.setPosition(YogaEdge.TOP, 0.7f);
root.setWidth(100f); root.setWidth(100f);
root.setHeight(113.4f); root.setHeight(113.4f);
@@ -743,7 +743,7 @@ public class CSSLayoutRoundingTest {
root_child2.setFlexGrow(1f); root_child2.setFlexGrow(1f);
root_child2.setHeight(10f); root_child2.setHeight(10f);
root.addChildAt(root_child2, 2); root.addChildAt(root_child2, 2);
root.setDirection(CSSDirection.LTR); root.setDirection(YogaDirection.LTR);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -766,7 +766,7 @@ public class CSSLayoutRoundingTest {
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f); assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(CSSDirection.RTL); root.setDirection(YogaDirection.RTL);
root.calculateLayout(); root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f); assertEquals(0f, root.getLayoutX(), 0.0f);
@@ -789,7 +789,7 @@ public class CSSLayoutRoundingTest {
assertEquals(100f, root_child2.getLayoutWidth(), 0.0f); assertEquals(100f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(24f, root_child2.getLayoutHeight(), 0.0f); assertEquals(24f, root_child2.getLayoutHeight(), 0.0f);
CSSNode.setExperimentalFeatureEnabled(CSSExperimentalFeature.ROUNDING, false); CSSNode.setExperimentalFeatureEnabled(YogaExperimentalFeature.ROUNDING, false);
} }
} }

View File

@@ -30,9 +30,9 @@ public class CSSNodeTest {
public long measure( public long measure(
CSSNodeAPI node, CSSNodeAPI node,
float width, float width,
CSSMeasureMode widthMode, YogaMeasureMode widthMode,
float height, float height,
CSSMeasureMode heightMode) { YogaMeasureMode heightMode) {
return MeasureOutput.make(100, 100); return MeasureOutput.make(100, 100);
} }
}); });
@@ -41,42 +41,42 @@ public class CSSNodeTest {
assertEquals(100, (int) node.getLayoutHeight()); assertEquals(100, (int) node.getLayoutHeight());
} }
private CSSLogLevel mLogLevel; private YogaLogLevel mLogLevel;
private String mLogMessage; private String mLogMessage;
@Test @Test
public void testLogger() { public void testLogger() {
CSSNode.setLogger(new CSSLogger() { CSSNode.setLogger(new CSSLogger() {
public void log(CSSLogLevel level, String message) { public void log(YogaLogLevel level, String message) {
mLogLevel = level; mLogLevel = level;
mLogMessage = message; mLogMessage = message;
} }
}); });
CSSNode.jni_CSSLog(CSSLogLevel.DEBUG.intValue(), "Hello"); CSSNode.jni_CSSLog(YogaLogLevel.DEBUG.intValue(), "Hello");
assertEquals(CSSLogLevel.DEBUG, mLogLevel); assertEquals(YogaLogLevel.DEBUG, mLogLevel);
assertEquals("Hello", mLogMessage); assertEquals("Hello", mLogMessage);
} }
@Test @Test
public void testUpdateLogger() { public void testUpdateLogger() {
CSSNode.setLogger(new CSSLogger() { CSSNode.setLogger(new CSSLogger() {
public void log(CSSLogLevel level, String message) {} public void log(YogaLogLevel level, String message) {}
}); });
CSSNode.setLogger(new CSSLogger() { CSSNode.setLogger(new CSSLogger() {
public void log(CSSLogLevel level, String message) { public void log(YogaLogLevel level, String message) {
mLogLevel = level; mLogLevel = level;
mLogMessage = message; mLogMessage = message;
} }
}); });
CSSNode.jni_CSSLog(CSSLogLevel.VERBOSE.intValue(), "Flexbox"); CSSNode.jni_CSSLog(YogaLogLevel.VERBOSE.intValue(), "Flexbox");
assertEquals(CSSLogLevel.VERBOSE, mLogLevel); assertEquals(YogaLogLevel.VERBOSE, mLogLevel);
assertEquals("Flexbox", mLogMessage); assertEquals("Flexbox", mLogMessage);
} }
@Test @Test
public void testCopyStyle() { public void testCopyStyle() {
final CSSNode node0 = new CSSNode(); final CSSNode node0 = new CSSNode();
assertTrue(CSSConstants.isUndefined(node0.getMaxHeight())); assertTrue(YogaConstants.isUndefined(node0.getMaxHeight()));
final CSSNode node1 = new CSSNode(); final CSSNode node1 = new CSSNode();
node1.setMaxHeight(100); node1.setMaxHeight(100);

View File

@@ -18,13 +18,13 @@ TEST(CSSLayoutTest, absolute_layout_width_height_start_top) {
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew(); const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetPositionType(root_child0, CSSPositionTypeAbsolute); CSSNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child0, CSSEdgeStart, 10); CSSNodeStyleSetPosition(root_child0, YGEdgeStart, 10);
CSSNodeStyleSetPosition(root_child0, CSSEdgeTop, 10); CSSNodeStyleSetPosition(root_child0, YGEdgeTop, 10);
CSSNodeStyleSetWidth(root_child0, 10); CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeStyleSetHeight(root_child0, 10); CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -57,13 +57,13 @@ TEST(CSSLayoutTest, absolute_layout_width_height_end_bottom) {
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew(); const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetPositionType(root_child0, CSSPositionTypeAbsolute); CSSNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child0, CSSEdgeEnd, 10); CSSNodeStyleSetPosition(root_child0, YGEdgeEnd, 10);
CSSNodeStyleSetPosition(root_child0, CSSEdgeBottom, 10); CSSNodeStyleSetPosition(root_child0, YGEdgeBottom, 10);
CSSNodeStyleSetWidth(root_child0, 10); CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeStyleSetHeight(root_child0, 10); CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -96,13 +96,13 @@ TEST(CSSLayoutTest, absolute_layout_start_top_end_bottom) {
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew(); const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetPositionType(root_child0, CSSPositionTypeAbsolute); CSSNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child0, CSSEdgeStart, 10); CSSNodeStyleSetPosition(root_child0, YGEdgeStart, 10);
CSSNodeStyleSetPosition(root_child0, CSSEdgeTop, 10); CSSNodeStyleSetPosition(root_child0, YGEdgeTop, 10);
CSSNodeStyleSetPosition(root_child0, CSSEdgeEnd, 10); CSSNodeStyleSetPosition(root_child0, YGEdgeEnd, 10);
CSSNodeStyleSetPosition(root_child0, CSSEdgeBottom, 10); CSSNodeStyleSetPosition(root_child0, YGEdgeBottom, 10);
CSSNodeInsertChild(root, root_child0, 0); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(80, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -135,15 +135,15 @@ TEST(CSSLayoutTest, absolute_layout_width_height_start_top_end_bottom) {
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew(); const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetPositionType(root_child0, CSSPositionTypeAbsolute); CSSNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child0, CSSEdgeStart, 10); CSSNodeStyleSetPosition(root_child0, YGEdgeStart, 10);
CSSNodeStyleSetPosition(root_child0, CSSEdgeTop, 10); CSSNodeStyleSetPosition(root_child0, YGEdgeTop, 10);
CSSNodeStyleSetPosition(root_child0, CSSEdgeEnd, 10); CSSNodeStyleSetPosition(root_child0, YGEdgeEnd, 10);
CSSNodeStyleSetPosition(root_child0, CSSEdgeBottom, 10); CSSNodeStyleSetPosition(root_child0, YGEdgeBottom, 10);
CSSNodeStyleSetWidth(root_child0, 10); CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeStyleSetHeight(root_child0, 10); CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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) { TEST(CSSLayoutTest, do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetOverflow(root, CSSOverflowHidden); CSSNodeStyleSetOverflow(root, YGOverflowHidden);
CSSNodeStyleSetWidth(root, 50); CSSNodeStyleSetWidth(root, 50);
CSSNodeStyleSetHeight(root, 50); CSSNodeStyleSetHeight(root, 50);
const CSSNodeRef root_child0 = CSSNodeNew(); const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetPositionType(root_child0, CSSPositionTypeAbsolute); CSSNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child0, CSSEdgeStart, 0); CSSNodeStyleSetPosition(root_child0, YGEdgeStart, 0);
CSSNodeStyleSetPosition(root_child0, CSSEdgeTop, 0); CSSNodeStyleSetPosition(root_child0, YGEdgeTop, 0);
CSSNodeInsertChild(root, root_child0, 0); CSSNodeInsertChild(root, root_child0, 0);
const CSSNodeRef root_child0_child0 = CSSNodeNew(); const CSSNodeRef root_child0_child0 = CSSNodeNew();
CSSNodeStyleSetWidth(root_child0_child0, 100); CSSNodeStyleSetWidth(root_child0_child0, 100);
CSSNodeStyleSetHeight(root_child0_child0, 100); CSSNodeStyleSetHeight(root_child0_child0, 100);
CSSNodeInsertChild(root_child0, root_child0_child0, 0); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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, CSSNodeLayoutGetWidth(root_child0_child0));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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) { TEST(CSSLayoutTest, absolute_layout_within_border) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetMargin(root, CSSEdgeLeft, 10); CSSNodeStyleSetMargin(root, YGEdgeLeft, 10);
CSSNodeStyleSetMargin(root, CSSEdgeTop, 10); CSSNodeStyleSetMargin(root, YGEdgeTop, 10);
CSSNodeStyleSetMargin(root, CSSEdgeRight, 10); CSSNodeStyleSetMargin(root, YGEdgeRight, 10);
CSSNodeStyleSetMargin(root, CSSEdgeBottom, 10); CSSNodeStyleSetMargin(root, YGEdgeBottom, 10);
CSSNodeStyleSetPadding(root, CSSEdgeLeft, 10); CSSNodeStyleSetPadding(root, YGEdgeLeft, 10);
CSSNodeStyleSetPadding(root, CSSEdgeTop, 10); CSSNodeStyleSetPadding(root, YGEdgeTop, 10);
CSSNodeStyleSetPadding(root, CSSEdgeRight, 10); CSSNodeStyleSetPadding(root, YGEdgeRight, 10);
CSSNodeStyleSetPadding(root, CSSEdgeBottom, 10); CSSNodeStyleSetPadding(root, YGEdgeBottom, 10);
CSSNodeStyleSetBorder(root, CSSEdgeLeft, 10); CSSNodeStyleSetBorder(root, YGEdgeLeft, 10);
CSSNodeStyleSetBorder(root, CSSEdgeTop, 10); CSSNodeStyleSetBorder(root, YGEdgeTop, 10);
CSSNodeStyleSetBorder(root, CSSEdgeRight, 10); CSSNodeStyleSetBorder(root, YGEdgeRight, 10);
CSSNodeStyleSetBorder(root, CSSEdgeBottom, 10); CSSNodeStyleSetBorder(root, YGEdgeBottom, 10);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew(); const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetPositionType(root_child0, CSSPositionTypeAbsolute); CSSNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child0, CSSEdgeLeft, 0); CSSNodeStyleSetPosition(root_child0, YGEdgeLeft, 0);
CSSNodeStyleSetPosition(root_child0, CSSEdgeTop, 0); CSSNodeStyleSetPosition(root_child0, YGEdgeTop, 0);
CSSNodeStyleSetWidth(root_child0, 50); CSSNodeStyleSetWidth(root_child0, 50);
CSSNodeStyleSetHeight(root_child0, 50); CSSNodeStyleSetHeight(root_child0, 50);
CSSNodeInsertChild(root, root_child0, 0); CSSNodeInsertChild(root, root_child0, 0);
const CSSNodeRef root_child1 = CSSNodeNew(); const CSSNodeRef root_child1 = CSSNodeNew();
CSSNodeStyleSetPositionType(root_child1, CSSPositionTypeAbsolute); CSSNodeStyleSetPositionType(root_child1, YGPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child1, CSSEdgeRight, 0); CSSNodeStyleSetPosition(root_child1, YGEdgeRight, 0);
CSSNodeStyleSetPosition(root_child1, CSSEdgeBottom, 0); CSSNodeStyleSetPosition(root_child1, YGEdgeBottom, 0);
CSSNodeStyleSetWidth(root_child1, 50); CSSNodeStyleSetWidth(root_child1, 50);
CSSNodeStyleSetHeight(root_child1, 50); CSSNodeStyleSetHeight(root_child1, 50);
CSSNodeInsertChild(root, root_child1, 1); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetTop(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, CSSNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetTop(root));

View File

@@ -14,7 +14,7 @@
TEST(CSSLayoutTest, align_content_flex_start) { TEST(CSSLayoutTest, align_content_flex_start) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexWrap(root, CSSWrapWrap); CSSNodeStyleSetFlexWrap(root, YGWrapWrap);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
@@ -42,7 +42,7 @@ TEST(CSSLayoutTest, align_content_flex_start) {
CSSNodeStyleSetWidth(root_child4, 50); CSSNodeStyleSetWidth(root_child4, 50);
CSSNodeStyleSetHeight(root_child4, 10); CSSNodeStyleSetHeight(root_child4, 10);
CSSNodeInsertChild(root, root_child4, 4); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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(50, CSSNodeLayoutGetWidth(root_child4));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -111,8 +111,8 @@ TEST(CSSLayoutTest, align_content_flex_start) {
TEST(CSSLayoutTest, align_content_flex_end) { TEST(CSSLayoutTest, align_content_flex_end) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignContent(root, CSSAlignFlexEnd); CSSNodeStyleSetAlignContent(root, YGAlignFlexEnd);
CSSNodeStyleSetFlexWrap(root, CSSWrapWrap); CSSNodeStyleSetFlexWrap(root, YGWrapWrap);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
@@ -140,7 +140,7 @@ TEST(CSSLayoutTest, align_content_flex_end) {
CSSNodeStyleSetWidth(root_child4, 50); CSSNodeStyleSetWidth(root_child4, 50);
CSSNodeStyleSetHeight(root_child4, 10); CSSNodeStyleSetHeight(root_child4, 10);
CSSNodeInsertChild(root, root_child4, 4); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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(50, CSSNodeLayoutGetWidth(root_child4));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -209,8 +209,8 @@ TEST(CSSLayoutTest, align_content_flex_end) {
TEST(CSSLayoutTest, align_content_center) { TEST(CSSLayoutTest, align_content_center) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignContent(root, CSSAlignCenter); CSSNodeStyleSetAlignContent(root, YGAlignCenter);
CSSNodeStyleSetFlexWrap(root, CSSWrapWrap); CSSNodeStyleSetFlexWrap(root, YGWrapWrap);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
@@ -238,7 +238,7 @@ TEST(CSSLayoutTest, align_content_center) {
CSSNodeStyleSetWidth(root_child4, 50); CSSNodeStyleSetWidth(root_child4, 50);
CSSNodeStyleSetHeight(root_child4, 10); CSSNodeStyleSetHeight(root_child4, 10);
CSSNodeInsertChild(root, root_child4, 4); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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(50, CSSNodeLayoutGetWidth(root_child4));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -307,8 +307,8 @@ TEST(CSSLayoutTest, align_content_center) {
TEST(CSSLayoutTest, align_content_stretch) { TEST(CSSLayoutTest, align_content_stretch) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignContent(root, CSSAlignStretch); CSSNodeStyleSetAlignContent(root, YGAlignStretch);
CSSNodeStyleSetFlexWrap(root, CSSWrapWrap); CSSNodeStyleSetFlexWrap(root, YGWrapWrap);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
@@ -331,7 +331,7 @@ TEST(CSSLayoutTest, align_content_stretch) {
const CSSNodeRef root_child4 = CSSNodeNew(); const CSSNodeRef root_child4 = CSSNodeNew();
CSSNodeStyleSetWidth(root_child4, 50); CSSNodeStyleSetWidth(root_child4, 50);
CSSNodeInsertChild(root, root_child4, 4); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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(50, CSSNodeLayoutGetWidth(root_child4));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));

View File

@@ -20,7 +20,7 @@ TEST(CSSLayoutTest, align_items_stretch) {
const CSSNodeRef root_child0 = CSSNodeNew(); const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetHeight(root_child0, 10); CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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(100, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -49,7 +49,7 @@ TEST(CSSLayoutTest, align_items_stretch) {
TEST(CSSLayoutTest, align_items_center) { TEST(CSSLayoutTest, align_items_center) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignCenter); CSSNodeStyleSetAlignItems(root, YGAlignCenter);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
@@ -57,7 +57,7 @@ TEST(CSSLayoutTest, align_items_center) {
CSSNodeStyleSetWidth(root_child0, 10); CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeStyleSetHeight(root_child0, 10); CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -86,7 +86,7 @@ TEST(CSSLayoutTest, align_items_center) {
TEST(CSSLayoutTest, align_items_flex_start) { TEST(CSSLayoutTest, align_items_flex_start) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
@@ -94,7 +94,7 @@ TEST(CSSLayoutTest, align_items_flex_start) {
CSSNodeStyleSetWidth(root_child0, 10); CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeStyleSetHeight(root_child0, 10); CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -123,7 +123,7 @@ TEST(CSSLayoutTest, align_items_flex_start) {
TEST(CSSLayoutTest, align_items_flex_end) { TEST(CSSLayoutTest, align_items_flex_end) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexEnd); CSSNodeStyleSetAlignItems(root, YGAlignFlexEnd);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
@@ -131,7 +131,7 @@ TEST(CSSLayoutTest, align_items_flex_end) {
CSSNodeStyleSetWidth(root_child0, 10); CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeStyleSetHeight(root_child0, 10); CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));

View File

@@ -18,11 +18,11 @@ TEST(CSSLayoutTest, align_self_center) {
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew(); const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetAlignSelf(root_child0, CSSAlignCenter); CSSNodeStyleSetAlignSelf(root_child0, YGAlignCenter);
CSSNodeStyleSetWidth(root_child0, 10); CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeStyleSetHeight(root_child0, 10); CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -55,11 +55,11 @@ TEST(CSSLayoutTest, align_self_flex_end) {
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew(); const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetAlignSelf(root_child0, CSSAlignFlexEnd); CSSNodeStyleSetAlignSelf(root_child0, YGAlignFlexEnd);
CSSNodeStyleSetWidth(root_child0, 10); CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeStyleSetHeight(root_child0, 10); CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -92,11 +92,11 @@ TEST(CSSLayoutTest, align_self_flex_start) {
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew(); const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetAlignSelf(root_child0, CSSAlignFlexStart); CSSNodeStyleSetAlignSelf(root_child0, YGAlignFlexStart);
CSSNodeStyleSetWidth(root_child0, 10); CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeStyleSetHeight(root_child0, 10); CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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) { TEST(CSSLayoutTest, align_self_flex_end_override_flex_start) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew(); const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetAlignSelf(root_child0, CSSAlignFlexEnd); CSSNodeStyleSetAlignSelf(root_child0, YGAlignFlexEnd);
CSSNodeStyleSetWidth(root_child0, 10); CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeStyleSetHeight(root_child0, 10); CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));

View File

@@ -12,18 +12,18 @@
static CSSSize _measure(CSSNodeRef node, static CSSSize _measure(CSSNodeRef node,
float width, float width,
CSSMeasureMode widthMode, YGMeasureMode widthMode,
float height, float height,
CSSMeasureMode heightMode) { YGMeasureMode heightMode) {
return CSSSize { return CSSSize {
.width = widthMode == CSSMeasureModeExactly ? width : 50, .width = widthMode == YGMeasureModeExactly ? width : 50,
.height = heightMode == CSSMeasureModeExactly ? height : 50, .height = heightMode == YGMeasureModeExactly ? height : 50,
}; };
} }
TEST(CSSLayoutTest, aspect_ratio_cross_defined) { TEST(CSSLayoutTest, aspect_ratio_cross_defined) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
@@ -32,7 +32,7 @@ TEST(CSSLayoutTest, aspect_ratio_cross_defined) {
CSSNodeStyleSetAspectRatio(root_child0, 1); CSSNodeStyleSetAspectRatio(root_child0, 1);
CSSNodeInsertChild(root, root_child0, 0); CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0));
@@ -44,7 +44,7 @@ TEST(CSSLayoutTest, aspect_ratio_cross_defined) {
TEST(CSSLayoutTest, aspect_ratio_main_defined) { TEST(CSSLayoutTest, aspect_ratio_main_defined) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
@@ -53,7 +53,7 @@ TEST(CSSLayoutTest, aspect_ratio_main_defined) {
CSSNodeStyleSetAspectRatio(root_child0, 1); CSSNodeStyleSetAspectRatio(root_child0, 1);
CSSNodeInsertChild(root, root_child0, 0); CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0));
@@ -73,7 +73,7 @@ TEST(CSSLayoutTest, aspect_ratio_both_dimensions_defined) {
CSSNodeStyleSetAspectRatio(root_child0, 1); CSSNodeStyleSetAspectRatio(root_child0, 1);
CSSNodeInsertChild(root, root_child0, 0); CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0));
@@ -92,7 +92,7 @@ TEST(CSSLayoutTest, aspect_ratio_align_stretch) {
CSSNodeStyleSetAspectRatio(root_child0, 1); CSSNodeStyleSetAspectRatio(root_child0, 1);
CSSNodeInsertChild(root, root_child0, 0); CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0));
@@ -104,7 +104,7 @@ TEST(CSSLayoutTest, aspect_ratio_align_stretch) {
TEST(CSSLayoutTest, aspect_ratio_flex_grow) { TEST(CSSLayoutTest, aspect_ratio_flex_grow) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
@@ -114,7 +114,7 @@ TEST(CSSLayoutTest, aspect_ratio_flex_grow) {
CSSNodeStyleSetAspectRatio(root_child0, 1); CSSNodeStyleSetAspectRatio(root_child0, 1);
CSSNodeInsertChild(root, root_child0, 0); CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0));
@@ -126,7 +126,7 @@ TEST(CSSLayoutTest, aspect_ratio_flex_grow) {
TEST(CSSLayoutTest, aspect_ratio_flex_shrink) { TEST(CSSLayoutTest, aspect_ratio_flex_shrink) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
@@ -136,7 +136,7 @@ TEST(CSSLayoutTest, aspect_ratio_flex_shrink) {
CSSNodeStyleSetAspectRatio(root_child0, 1); CSSNodeStyleSetAspectRatio(root_child0, 1);
CSSNodeInsertChild(root, root_child0, 0); CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0));
@@ -148,7 +148,7 @@ TEST(CSSLayoutTest, aspect_ratio_flex_shrink) {
TEST(CSSLayoutTest, aspect_ratio_basis) { TEST(CSSLayoutTest, aspect_ratio_basis) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
@@ -157,7 +157,7 @@ TEST(CSSLayoutTest, aspect_ratio_basis) {
CSSNodeStyleSetAspectRatio(root_child0, 1); CSSNodeStyleSetAspectRatio(root_child0, 1);
CSSNodeInsertChild(root, root_child0, 0); CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0));
@@ -173,14 +173,14 @@ TEST(CSSLayoutTest, aspect_ratio_absolute_layout_width_defined) {
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew(); const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetPositionType(root_child0, CSSPositionTypeAbsolute); CSSNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child0, CSSEdgeLeft, 0); CSSNodeStyleSetPosition(root_child0, YGEdgeLeft, 0);
CSSNodeStyleSetPosition(root_child0, CSSEdgeTop, 0); CSSNodeStyleSetPosition(root_child0, YGEdgeTop, 0);
CSSNodeStyleSetWidth(root_child0, 50); CSSNodeStyleSetWidth(root_child0, 50);
CSSNodeStyleSetAspectRatio(root_child0, 1); CSSNodeStyleSetAspectRatio(root_child0, 1);
CSSNodeInsertChild(root, root_child0, 0); CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0));
@@ -196,14 +196,14 @@ TEST(CSSLayoutTest, aspect_ratio_absolute_layout_height_defined) {
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew(); const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetPositionType(root_child0, CSSPositionTypeAbsolute); CSSNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child0, CSSEdgeLeft, 0); CSSNodeStyleSetPosition(root_child0, YGEdgeLeft, 0);
CSSNodeStyleSetPosition(root_child0, CSSEdgeTop, 0); CSSNodeStyleSetPosition(root_child0, YGEdgeTop, 0);
CSSNodeStyleSetHeight(root_child0, 50); CSSNodeStyleSetHeight(root_child0, 50);
CSSNodeStyleSetAspectRatio(root_child0, 1); CSSNodeStyleSetAspectRatio(root_child0, 1);
CSSNodeInsertChild(root, root_child0, 0); CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(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) { TEST(CSSLayoutTest, aspect_ratio_with_max_cross_defined) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
@@ -225,7 +225,7 @@ TEST(CSSLayoutTest, aspect_ratio_with_max_cross_defined) {
CSSNodeStyleSetAspectRatio(root_child0, 1); CSSNodeStyleSetAspectRatio(root_child0, 1);
CSSNodeInsertChild(root, root_child0, 0); CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(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) { TEST(CSSLayoutTest, aspect_ratio_with_max_main_defined) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
@@ -247,7 +247,7 @@ TEST(CSSLayoutTest, aspect_ratio_with_max_main_defined) {
CSSNodeStyleSetAspectRatio(root_child0, 1); CSSNodeStyleSetAspectRatio(root_child0, 1);
CSSNodeInsertChild(root, root_child0, 0); CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(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) { TEST(CSSLayoutTest, aspect_ratio_with_min_cross_defined) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
@@ -269,7 +269,7 @@ TEST(CSSLayoutTest, aspect_ratio_with_min_cross_defined) {
CSSNodeStyleSetAspectRatio(root_child0, 1); CSSNodeStyleSetAspectRatio(root_child0, 1);
CSSNodeInsertChild(root, root_child0, 0); CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(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) { TEST(CSSLayoutTest, aspect_ratio_with_min_main_defined) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
@@ -291,7 +291,7 @@ TEST(CSSLayoutTest, aspect_ratio_with_min_main_defined) {
CSSNodeStyleSetAspectRatio(root_child0, 1); CSSNodeStyleSetAspectRatio(root_child0, 1);
CSSNodeInsertChild(root, root_child0, 0); CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(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) { TEST(CSSLayoutTest, aspect_ratio_double_cross) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
@@ -312,7 +312,7 @@ TEST(CSSLayoutTest, aspect_ratio_double_cross) {
CSSNodeStyleSetAspectRatio(root_child0, 2); CSSNodeStyleSetAspectRatio(root_child0, 2);
CSSNodeInsertChild(root, root_child0, 0); CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0));
@@ -324,7 +324,7 @@ TEST(CSSLayoutTest, aspect_ratio_double_cross) {
TEST(CSSLayoutTest, aspect_ratio_half_cross) { TEST(CSSLayoutTest, aspect_ratio_half_cross) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
@@ -333,7 +333,7 @@ TEST(CSSLayoutTest, aspect_ratio_half_cross) {
CSSNodeStyleSetAspectRatio(root_child0, 0.5); CSSNodeStyleSetAspectRatio(root_child0, 0.5);
CSSNodeInsertChild(root, root_child0, 0); CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0));
@@ -345,7 +345,7 @@ TEST(CSSLayoutTest, aspect_ratio_half_cross) {
TEST(CSSLayoutTest, aspect_ratio_double_main) { TEST(CSSLayoutTest, aspect_ratio_double_main) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
@@ -354,7 +354,7 @@ TEST(CSSLayoutTest, aspect_ratio_double_main) {
CSSNodeStyleSetAspectRatio(root_child0, 2); CSSNodeStyleSetAspectRatio(root_child0, 2);
CSSNodeInsertChild(root, root_child0, 0); CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0));
@@ -366,7 +366,7 @@ TEST(CSSLayoutTest, aspect_ratio_double_main) {
TEST(CSSLayoutTest, aspect_ratio_half_main) { TEST(CSSLayoutTest, aspect_ratio_half_main) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
@@ -375,7 +375,7 @@ TEST(CSSLayoutTest, aspect_ratio_half_main) {
CSSNodeStyleSetAspectRatio(root_child0, 0.5); CSSNodeStyleSetAspectRatio(root_child0, 0.5);
CSSNodeInsertChild(root, root_child0, 0); CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(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) { TEST(CSSLayoutTest, aspect_ratio_with_measure_func) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
@@ -396,7 +396,7 @@ TEST(CSSLayoutTest, aspect_ratio_with_measure_func) {
CSSNodeStyleSetAspectRatio(root_child0, 1); CSSNodeStyleSetAspectRatio(root_child0, 1);
CSSNodeInsertChild(root, root_child0, 0); CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0)); ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0));

View File

@@ -14,18 +14,18 @@
TEST(CSSLayoutTest, border_no_size) { TEST(CSSLayoutTest, border_no_size) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetBorder(root, CSSEdgeLeft, 10); CSSNodeStyleSetBorder(root, YGEdgeLeft, 10);
CSSNodeStyleSetBorder(root, CSSEdgeTop, 10); CSSNodeStyleSetBorder(root, YGEdgeTop, 10);
CSSNodeStyleSetBorder(root, CSSEdgeRight, 10); CSSNodeStyleSetBorder(root, YGEdgeRight, 10);
CSSNodeStyleSetBorder(root, CSSEdgeBottom, 10); CSSNodeStyleSetBorder(root, YGEdgeBottom, 10);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetWidth(root)); ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetWidth(root));
ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -37,16 +37,16 @@ TEST(CSSLayoutTest, border_no_size) {
TEST(CSSLayoutTest, border_container_match_child) { TEST(CSSLayoutTest, border_container_match_child) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetBorder(root, CSSEdgeLeft, 10); CSSNodeStyleSetBorder(root, YGEdgeLeft, 10);
CSSNodeStyleSetBorder(root, CSSEdgeTop, 10); CSSNodeStyleSetBorder(root, YGEdgeTop, 10);
CSSNodeStyleSetBorder(root, CSSEdgeRight, 10); CSSNodeStyleSetBorder(root, YGEdgeRight, 10);
CSSNodeStyleSetBorder(root, CSSEdgeBottom, 10); CSSNodeStyleSetBorder(root, YGEdgeBottom, 10);
const CSSNodeRef root_child0 = CSSNodeNew(); const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetWidth(root_child0, 10); CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeStyleSetHeight(root_child0, 10); CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -75,10 +75,10 @@ TEST(CSSLayoutTest, border_container_match_child) {
TEST(CSSLayoutTest, border_flex_child) { TEST(CSSLayoutTest, border_flex_child) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetBorder(root, CSSEdgeLeft, 10); CSSNodeStyleSetBorder(root, YGEdgeLeft, 10);
CSSNodeStyleSetBorder(root, CSSEdgeTop, 10); CSSNodeStyleSetBorder(root, YGEdgeTop, 10);
CSSNodeStyleSetBorder(root, CSSEdgeRight, 10); CSSNodeStyleSetBorder(root, YGEdgeRight, 10);
CSSNodeStyleSetBorder(root, CSSEdgeBottom, 10); CSSNodeStyleSetBorder(root, YGEdgeBottom, 10);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
@@ -86,7 +86,7 @@ TEST(CSSLayoutTest, border_flex_child) {
CSSNodeStyleSetFlexGrow(root_child0, 1); CSSNodeStyleSetFlexGrow(root_child0, 1);
CSSNodeStyleSetWidth(root_child0, 10); CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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(10, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(80, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -115,17 +115,17 @@ TEST(CSSLayoutTest, border_flex_child) {
TEST(CSSLayoutTest, border_stretch_child) { TEST(CSSLayoutTest, border_stretch_child) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetBorder(root, CSSEdgeLeft, 10); CSSNodeStyleSetBorder(root, YGEdgeLeft, 10);
CSSNodeStyleSetBorder(root, CSSEdgeTop, 10); CSSNodeStyleSetBorder(root, YGEdgeTop, 10);
CSSNodeStyleSetBorder(root, CSSEdgeRight, 10); CSSNodeStyleSetBorder(root, YGEdgeRight, 10);
CSSNodeStyleSetBorder(root, CSSEdgeBottom, 10); CSSNodeStyleSetBorder(root, YGEdgeBottom, 10);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew(); const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetHeight(root_child0, 10); CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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(80, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -154,11 +154,11 @@ TEST(CSSLayoutTest, border_stretch_child) {
TEST(CSSLayoutTest, border_center_child) { TEST(CSSLayoutTest, border_center_child) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetJustifyContent(root, CSSJustifyCenter); CSSNodeStyleSetJustifyContent(root, YGJustifyCenter);
CSSNodeStyleSetAlignItems(root, CSSAlignCenter); CSSNodeStyleSetAlignItems(root, YGAlignCenter);
CSSNodeStyleSetBorder(root, CSSEdgeStart, 10); CSSNodeStyleSetBorder(root, YGEdgeStart, 10);
CSSNodeStyleSetBorder(root, CSSEdgeEnd, 20); CSSNodeStyleSetBorder(root, YGEdgeEnd, 20);
CSSNodeStyleSetBorder(root, CSSEdgeBottom, 20); CSSNodeStyleSetBorder(root, YGEdgeBottom, 20);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
@@ -166,7 +166,7 @@ TEST(CSSLayoutTest, border_center_child) {
CSSNodeStyleSetWidth(root_child0, 10); CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeStyleSetHeight(root_child0, 10); CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));

View File

@@ -16,46 +16,46 @@ TEST(CSSLayoutTest, assert_default_values) {
ASSERT_EQ(0, CSSNodeChildCount(root)); ASSERT_EQ(0, CSSNodeChildCount(root));
ASSERT_EQ(NULL, CSSNodeGetChild(root, 1)); ASSERT_EQ(NULL, CSSNodeGetChild(root, 1));
ASSERT_EQ(CSSDirectionInherit, CSSNodeStyleGetDirection(root)); ASSERT_EQ(YGDirectionInherit, CSSNodeStyleGetDirection(root));
ASSERT_EQ(CSSFlexDirectionColumn, CSSNodeStyleGetFlexDirection(root)); ASSERT_EQ(YGFlexDirectionColumn, CSSNodeStyleGetFlexDirection(root));
ASSERT_EQ(CSSJustifyFlexStart, CSSNodeStyleGetJustifyContent(root)); ASSERT_EQ(YGJustifyFlexStart, CSSNodeStyleGetJustifyContent(root));
ASSERT_EQ(CSSAlignFlexStart, CSSNodeStyleGetAlignContent(root)); ASSERT_EQ(YGAlignFlexStart, CSSNodeStyleGetAlignContent(root));
ASSERT_EQ(CSSAlignStretch, CSSNodeStyleGetAlignItems(root)); ASSERT_EQ(YGAlignStretch, CSSNodeStyleGetAlignItems(root));
ASSERT_EQ(CSSAlignAuto, CSSNodeStyleGetAlignSelf(root)); ASSERT_EQ(YGAlignAuto, CSSNodeStyleGetAlignSelf(root));
ASSERT_EQ(CSSPositionTypeRelative, CSSNodeStyleGetPositionType(root)); ASSERT_EQ(YGPositionTypeRelative, CSSNodeStyleGetPositionType(root));
ASSERT_EQ(CSSWrapNoWrap, CSSNodeStyleGetFlexWrap(root)); ASSERT_EQ(YGWrapNoWrap, CSSNodeStyleGetFlexWrap(root));
ASSERT_EQ(CSSOverflowVisible, CSSNodeStyleGetOverflow(root)); ASSERT_EQ(YGOverflowVisible, CSSNodeStyleGetOverflow(root));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetFlexGrow(root)); ASSERT_FLOAT_EQ(0, CSSNodeStyleGetFlexGrow(root));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetFlexShrink(root)); ASSERT_FLOAT_EQ(0, CSSNodeStyleGetFlexShrink(root));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetFlexBasis(root))); ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetFlexBasis(root)));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPosition(root, CSSEdgeLeft))); ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPosition(root, YGEdgeLeft)));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPosition(root, CSSEdgeTop))); ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPosition(root, YGEdgeTop)));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPosition(root, CSSEdgeRight))); ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPosition(root, YGEdgeRight)));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPosition(root, CSSEdgeBottom))); ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPosition(root, YGEdgeBottom)));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPosition(root, CSSEdgeStart))); ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPosition(root, YGEdgeStart)));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPosition(root, CSSEdgeEnd))); ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPosition(root, YGEdgeEnd)));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetMargin(root, CSSEdgeLeft)); ASSERT_FLOAT_EQ(0, CSSNodeStyleGetMargin(root, YGEdgeLeft));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetMargin(root, CSSEdgeTop)); ASSERT_FLOAT_EQ(0, CSSNodeStyleGetMargin(root, YGEdgeTop));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetMargin(root, CSSEdgeRight)); ASSERT_FLOAT_EQ(0, CSSNodeStyleGetMargin(root, YGEdgeRight));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetMargin(root, CSSEdgeBottom)); ASSERT_FLOAT_EQ(0, CSSNodeStyleGetMargin(root, YGEdgeBottom));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetMargin(root, CSSEdgeStart))); ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetMargin(root, YGEdgeStart)));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetMargin(root, CSSEdgeEnd))); ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetMargin(root, YGEdgeEnd)));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetPadding(root, CSSEdgeLeft)); ASSERT_FLOAT_EQ(0, CSSNodeStyleGetPadding(root, YGEdgeLeft));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetPadding(root, CSSEdgeTop)); ASSERT_FLOAT_EQ(0, CSSNodeStyleGetPadding(root, YGEdgeTop));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetPadding(root, CSSEdgeRight)); ASSERT_FLOAT_EQ(0, CSSNodeStyleGetPadding(root, YGEdgeRight));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetPadding(root, CSSEdgeBottom)); ASSERT_FLOAT_EQ(0, CSSNodeStyleGetPadding(root, YGEdgeBottom));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPadding(root, CSSEdgeStart))); ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPadding(root, YGEdgeStart)));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPadding(root, CSSEdgeEnd))); ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetPadding(root, YGEdgeEnd)));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetBorder(root, CSSEdgeLeft)); ASSERT_FLOAT_EQ(0, CSSNodeStyleGetBorder(root, YGEdgeLeft));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetBorder(root, CSSEdgeTop)); ASSERT_FLOAT_EQ(0, CSSNodeStyleGetBorder(root, YGEdgeTop));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetBorder(root, CSSEdgeRight)); ASSERT_FLOAT_EQ(0, CSSNodeStyleGetBorder(root, YGEdgeRight));
ASSERT_FLOAT_EQ(0, CSSNodeStyleGetBorder(root, CSSEdgeBottom)); ASSERT_FLOAT_EQ(0, CSSNodeStyleGetBorder(root, YGEdgeBottom));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetBorder(root, CSSEdgeStart))); ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetBorder(root, YGEdgeStart)));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetBorder(root, CSSEdgeEnd))); ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetBorder(root, YGEdgeEnd)));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetWidth(root))); ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetWidth(root)));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetHeight(root))); ASSERT_TRUE(CSSValueIsUndefined(CSSNodeStyleGetHeight(root)));
@@ -70,7 +70,7 @@ TEST(CSSLayoutTest, assert_default_values) {
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetBottom(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetBottom(root));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeLayoutGetWidth(root))); ASSERT_TRUE(CSSValueIsUndefined(CSSNodeLayoutGetWidth(root)));
ASSERT_TRUE(CSSValueIsUndefined(CSSNodeLayoutGetHeight(root))); ASSERT_TRUE(CSSValueIsUndefined(CSSNodeLayoutGetHeight(root)));
ASSERT_EQ(CSSDirectionInherit, CSSNodeLayoutGetDirection(root)); ASSERT_EQ(YGDirectionInherit, CSSNodeLayoutGetDirection(root));
CSSNodeFreeRecursive(root); CSSNodeFreeRecursive(root);
} }

View File

@@ -12,7 +12,7 @@
TEST(CSSLayoutTest, dirty_propagation) { TEST(CSSLayoutTest, dirty_propagation) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
@@ -26,7 +26,7 @@ TEST(CSSLayoutTest, dirty_propagation) {
CSSNodeStyleSetHeight(root_child1, 20); CSSNodeStyleSetHeight(root_child1, 20);
CSSNodeInsertChild(root, root_child1, 1); CSSNodeInsertChild(root, root_child1, 1);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
CSSNodeStyleSetWidth(root_child0, 20); CSSNodeStyleSetWidth(root_child0, 20);
@@ -34,7 +34,7 @@ TEST(CSSLayoutTest, dirty_propagation) {
EXPECT_FALSE(CSSNodeIsDirty(root_child1)); EXPECT_FALSE(CSSNodeIsDirty(root_child1));
EXPECT_TRUE(CSSNodeIsDirty(root)); EXPECT_TRUE(CSSNodeIsDirty(root));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
EXPECT_FALSE(CSSNodeIsDirty(root_child0)); EXPECT_FALSE(CSSNodeIsDirty(root_child0));
EXPECT_FALSE(CSSNodeIsDirty(root_child1)); EXPECT_FALSE(CSSNodeIsDirty(root_child1));
@@ -45,7 +45,7 @@ TEST(CSSLayoutTest, dirty_propagation) {
TEST(CSSLayoutTest, dirty_propagation_only_if_prop_changed) { TEST(CSSLayoutTest, dirty_propagation_only_if_prop_changed) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
@@ -59,7 +59,7 @@ TEST(CSSLayoutTest, dirty_propagation_only_if_prop_changed) {
CSSNodeStyleSetHeight(root_child1, 20); CSSNodeStyleSetHeight(root_child1, 20);
CSSNodeInsertChild(root, root_child1, 1); CSSNodeInsertChild(root, root_child1, 1);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
CSSNodeStyleSetWidth(root_child0, 50); 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) { TEST(CSSLayoutTest, dirty_node_only_if_children_are_actually_removed) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 50); CSSNodeStyleSetWidth(root, 50);
CSSNodeStyleSetHeight(root, 50); CSSNodeStyleSetHeight(root, 50);
@@ -81,7 +81,7 @@ TEST(CSSLayoutTest, dirty_node_only_if_children_are_actually_removed) {
CSSNodeStyleSetHeight(child0, 25); CSSNodeStyleSetHeight(child0, 25);
CSSNodeInsertChild(root, child0, 0); CSSNodeInsertChild(root, child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
const CSSNodeRef child1 = CSSNodeNew(); const CSSNodeRef child1 = CSSNodeNew();
CSSNodeRemoveChild(root, child1); CSSNodeRemoveChild(root, child1);

View File

@@ -12,22 +12,22 @@
TEST(CSSLayoutTest, start_overrides) { TEST(CSSLayoutTest, start_overrides) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew(); const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child0, 1); CSSNodeStyleSetFlexGrow(root_child0, 1);
CSSNodeStyleSetMargin(root_child0, CSSEdgeStart, 10); CSSNodeStyleSetMargin(root_child0, YGEdgeStart, 10);
CSSNodeStyleSetMargin(root_child0, CSSEdgeLeft, 20); CSSNodeStyleSetMargin(root_child0, YGEdgeLeft, 20);
CSSNodeStyleSetMargin(root_child0, CSSEdgeRight, 20); CSSNodeStyleSetMargin(root_child0, YGEdgeRight, 20);
CSSNodeInsertChild(root, root_child0, 0); 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, CSSNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetRight(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(20, CSSNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetRight(root_child0)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetRight(root_child0));
@@ -36,22 +36,22 @@ TEST(CSSLayoutTest, start_overrides) {
TEST(CSSLayoutTest, end_overrides) { TEST(CSSLayoutTest, end_overrides) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew(); const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child0, 1); CSSNodeStyleSetFlexGrow(root_child0, 1);
CSSNodeStyleSetMargin(root_child0, CSSEdgeEnd, 10); CSSNodeStyleSetMargin(root_child0, YGEdgeEnd, 10);
CSSNodeStyleSetMargin(root_child0, CSSEdgeLeft, 20); CSSNodeStyleSetMargin(root_child0, YGEdgeLeft, 20);
CSSNodeStyleSetMargin(root_child0, CSSEdgeRight, 20); CSSNodeStyleSetMargin(root_child0, YGEdgeRight, 20);
CSSNodeInsertChild(root, root_child0, 0); 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(20, CSSNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetRight(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(10, CSSNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetRight(root_child0)); ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetRight(root_child0));
@@ -60,17 +60,17 @@ TEST(CSSLayoutTest, end_overrides) {
TEST(CSSLayoutTest, horizontal_overridden) { TEST(CSSLayoutTest, horizontal_overridden) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew(); const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child0, 1); CSSNodeStyleSetFlexGrow(root_child0, 1);
CSSNodeStyleSetMargin(root_child0, CSSEdgeHorizontal, 10); CSSNodeStyleSetMargin(root_child0, YGEdgeHorizontal, 10);
CSSNodeStyleSetMargin(root_child0, CSSEdgeLeft, 20); CSSNodeStyleSetMargin(root_child0, YGEdgeLeft, 20);
CSSNodeInsertChild(root, root_child0, 0); 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(20, CSSNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetRight(root_child0)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetRight(root_child0));
@@ -79,17 +79,17 @@ TEST(CSSLayoutTest, horizontal_overridden) {
TEST(CSSLayoutTest, vertical_overridden) { TEST(CSSLayoutTest, vertical_overridden) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionColumn); CSSNodeStyleSetFlexDirection(root, YGFlexDirectionColumn);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew(); const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child0, 1); CSSNodeStyleSetFlexGrow(root_child0, 1);
CSSNodeStyleSetMargin(root_child0, CSSEdgeVertical, 10); CSSNodeStyleSetMargin(root_child0, YGEdgeVertical, 10);
CSSNodeStyleSetMargin(root_child0, CSSEdgeTop, 20); CSSNodeStyleSetMargin(root_child0, YGEdgeTop, 20);
CSSNodeInsertChild(root, root_child0, 0); 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(20, CSSNodeLayoutGetTop(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetBottom(root_child0)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetBottom(root_child0));
@@ -98,17 +98,17 @@ TEST(CSSLayoutTest, vertical_overridden) {
TEST(CSSLayoutTest, horizontal_overrides_all) { TEST(CSSLayoutTest, horizontal_overrides_all) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionColumn); CSSNodeStyleSetFlexDirection(root, YGFlexDirectionColumn);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew(); const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child0, 1); CSSNodeStyleSetFlexGrow(root_child0, 1);
CSSNodeStyleSetMargin(root_child0, CSSEdgeHorizontal, 10); CSSNodeStyleSetMargin(root_child0, YGEdgeHorizontal, 10);
CSSNodeStyleSetMargin(root_child0, CSSEdgeAll, 20); CSSNodeStyleSetMargin(root_child0, YGEdgeAll, 20);
CSSNodeInsertChild(root, root_child0, 0); 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, CSSNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetTop(root_child0)); ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetTop(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetRight(root_child0)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetRight(root_child0));
@@ -119,17 +119,17 @@ TEST(CSSLayoutTest, horizontal_overrides_all) {
TEST(CSSLayoutTest, vertical_overrides_all) { TEST(CSSLayoutTest, vertical_overrides_all) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionColumn); CSSNodeStyleSetFlexDirection(root, YGFlexDirectionColumn);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew(); const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child0, 1); CSSNodeStyleSetFlexGrow(root_child0, 1);
CSSNodeStyleSetMargin(root_child0, CSSEdgeVertical, 10); CSSNodeStyleSetMargin(root_child0, YGEdgeVertical, 10);
CSSNodeStyleSetMargin(root_child0, CSSEdgeAll, 20); CSSNodeStyleSetMargin(root_child0, YGEdgeAll, 20);
CSSNodeInsertChild(root, root_child0, 0); 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(20, CSSNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetTop(root_child0)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetTop(root_child0));
ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetRight(root_child0)); ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetRight(root_child0));
@@ -140,20 +140,20 @@ TEST(CSSLayoutTest, vertical_overrides_all) {
TEST(CSSLayoutTest, all_overridden) { TEST(CSSLayoutTest, all_overridden) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionColumn); CSSNodeStyleSetFlexDirection(root, YGFlexDirectionColumn);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew(); const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child0, 1); CSSNodeStyleSetFlexGrow(root_child0, 1);
CSSNodeStyleSetMargin(root_child0, CSSEdgeLeft, 10); CSSNodeStyleSetMargin(root_child0, YGEdgeLeft, 10);
CSSNodeStyleSetMargin(root_child0, CSSEdgeTop, 10); CSSNodeStyleSetMargin(root_child0, YGEdgeTop, 10);
CSSNodeStyleSetMargin(root_child0, CSSEdgeRight, 10); CSSNodeStyleSetMargin(root_child0, YGEdgeRight, 10);
CSSNodeStyleSetMargin(root_child0, CSSEdgeBottom, 10); CSSNodeStyleSetMargin(root_child0, YGEdgeBottom, 10);
CSSNodeStyleSetMargin(root_child0, CSSEdgeAll, 20); CSSNodeStyleSetMargin(root_child0, YGEdgeAll, 20);
CSSNodeInsertChild(root, root_child0, 0); 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, CSSNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetTop(root_child0)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetTop(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetRight(root_child0)); ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetRight(root_child0));

View File

@@ -27,7 +27,7 @@ TEST(CSSLayoutTest, flex_direction_column_no_height) {
const CSSNodeRef root_child2 = CSSNodeNew(); const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetHeight(root_child2, 10); CSSNodeStyleSetHeight(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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(100, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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) { TEST(CSSLayoutTest, flex_direction_row_no_width) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew(); const CSSNodeRef root_child0 = CSSNodeNew();
@@ -90,7 +90,7 @@ TEST(CSSLayoutTest, flex_direction_row_no_width) {
const CSSNodeRef root_child2 = CSSNodeNew(); const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetWidth(root_child2, 10); CSSNodeStyleSetWidth(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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(10, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -153,7 +153,7 @@ TEST(CSSLayoutTest, flex_direction_column) {
const CSSNodeRef root_child2 = CSSNodeNew(); const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetHeight(root_child2, 10); CSSNodeStyleSetHeight(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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(100, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -202,7 +202,7 @@ TEST(CSSLayoutTest, flex_direction_column) {
TEST(CSSLayoutTest, flex_direction_row) { TEST(CSSLayoutTest, flex_direction_row) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
@@ -217,7 +217,7 @@ TEST(CSSLayoutTest, flex_direction_row) {
const CSSNodeRef root_child2 = CSSNodeNew(); const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetWidth(root_child2, 10); CSSNodeStyleSetWidth(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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(10, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -266,7 +266,7 @@ TEST(CSSLayoutTest, flex_direction_row) {
TEST(CSSLayoutTest, flex_direction_column_reverse) { TEST(CSSLayoutTest, flex_direction_column_reverse) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionColumnReverse); CSSNodeStyleSetFlexDirection(root, YGFlexDirectionColumnReverse);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
@@ -281,7 +281,7 @@ TEST(CSSLayoutTest, flex_direction_column_reverse) {
const CSSNodeRef root_child2 = CSSNodeNew(); const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetHeight(root_child2, 10); CSSNodeStyleSetHeight(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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(100, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -330,7 +330,7 @@ TEST(CSSLayoutTest, flex_direction_column_reverse) {
TEST(CSSLayoutTest, flex_direction_row_reverse) { TEST(CSSLayoutTest, flex_direction_row_reverse) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRowReverse); CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRowReverse);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
@@ -345,7 +345,7 @@ TEST(CSSLayoutTest, flex_direction_row_reverse) {
const CSSNodeRef root_child2 = CSSNodeNew(); const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetWidth(root_child2, 10); CSSNodeStyleSetWidth(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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(10, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));

View File

@@ -25,7 +25,7 @@ TEST(CSSLayoutTest, flex_basis_flex_grow_column) {
const CSSNodeRef root_child1 = CSSNodeNew(); const CSSNodeRef root_child1 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child1, 1); CSSNodeStyleSetFlexGrow(root_child1, 1);
CSSNodeInsertChild(root, 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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(100, CSSNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(25, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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) { TEST(CSSLayoutTest, flex_basis_flex_grow_row) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
@@ -76,7 +76,7 @@ TEST(CSSLayoutTest, flex_basis_flex_grow_row) {
const CSSNodeRef root_child1 = CSSNodeNew(); const CSSNodeRef root_child1 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child1, 1); CSSNodeStyleSetFlexGrow(root_child1, 1);
CSSNodeInsertChild(root, 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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(25, CSSNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -126,7 +126,7 @@ TEST(CSSLayoutTest, flex_basis_flex_shrink_column) {
const CSSNodeRef root_child1 = CSSNodeNew(); const CSSNodeRef root_child1 = CSSNodeNew();
CSSNodeStyleSetFlexBasis(root_child1, 50); CSSNodeStyleSetFlexBasis(root_child1, 50);
CSSNodeInsertChild(root, 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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(100, CSSNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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) { TEST(CSSLayoutTest, flex_basis_flex_shrink_row) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
@@ -177,7 +177,7 @@ TEST(CSSLayoutTest, flex_basis_flex_shrink_row) {
const CSSNodeRef root_child1 = CSSNodeNew(); const CSSNodeRef root_child1 = CSSNodeNew();
CSSNodeStyleSetFlexBasis(root_child1, 50); CSSNodeStyleSetFlexBasis(root_child1, 50);
CSSNodeInsertChild(root, 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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(50, CSSNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -233,7 +233,7 @@ TEST(CSSLayoutTest, flex_shrink_to_zero) {
CSSNodeStyleSetWidth(root_child2, 50); CSSNodeStyleSetWidth(root_child2, 50);
CSSNodeStyleSetHeight(root_child2, 50); CSSNodeStyleSetHeight(root_child2, 50);
CSSNodeInsertChild(root, root_child2, 2); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -300,7 +300,7 @@ TEST(CSSLayoutTest, flex_basis_overrides_main_size) {
CSSNodeStyleSetFlexGrow(root_child2, 1); CSSNodeStyleSetFlexGrow(root_child2, 1);
CSSNodeStyleSetHeight(root_child2, 10); CSSNodeStyleSetHeight(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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(100, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -359,7 +359,7 @@ TEST(CSSLayoutTest, flex_grow_shrink_at_most) {
CSSNodeStyleSetFlexGrow(root_child0_child0, 1); CSSNodeStyleSetFlexGrow(root_child0_child0, 1);
CSSNodeStyleSetFlexShrink(root_child0_child0, 1); CSSNodeStyleSetFlexShrink(root_child0_child0, 1);
CSSNodeInsertChild(root_child0, root_child0_child0, 0); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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(100, CSSNodeLayoutGetWidth(root_child0_child0));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));

View File

@@ -14,7 +14,7 @@
TEST(CSSLayoutTest, wrap_column) { TEST(CSSLayoutTest, wrap_column) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexWrap(root, CSSWrapWrap); CSSNodeStyleSetFlexWrap(root, YGWrapWrap);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew(); const CSSNodeRef root_child0 = CSSNodeNew();
@@ -36,7 +36,7 @@ TEST(CSSLayoutTest, wrap_column) {
CSSNodeStyleSetWidth(root_child3, 30); CSSNodeStyleSetWidth(root_child3, 30);
CSSNodeStyleSetHeight(root_child3, 30); CSSNodeStyleSetHeight(root_child3, 30);
CSSNodeInsertChild(root, root_child3, 3); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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, CSSNodeLayoutGetWidth(root_child3));
ASSERT_FLOAT_EQ(30, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -95,8 +95,8 @@ TEST(CSSLayoutTest, wrap_column) {
TEST(CSSLayoutTest, wrap_row) { TEST(CSSLayoutTest, wrap_row) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetFlexWrap(root, CSSWrapWrap); CSSNodeStyleSetFlexWrap(root, YGWrapWrap);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew(); const CSSNodeRef root_child0 = CSSNodeNew();
@@ -118,7 +118,7 @@ TEST(CSSLayoutTest, wrap_row) {
CSSNodeStyleSetWidth(root_child3, 30); CSSNodeStyleSetWidth(root_child3, 30);
CSSNodeStyleSetHeight(root_child3, 30); CSSNodeStyleSetHeight(root_child3, 30);
CSSNodeInsertChild(root, root_child3, 3); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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, CSSNodeLayoutGetWidth(root_child3));
ASSERT_FLOAT_EQ(30, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -177,9 +177,9 @@ TEST(CSSLayoutTest, wrap_row) {
TEST(CSSLayoutTest, wrap_row_align_items_flex_end) { TEST(CSSLayoutTest, wrap_row_align_items_flex_end) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetAlignItems(root, CSSAlignFlexEnd); CSSNodeStyleSetAlignItems(root, YGAlignFlexEnd);
CSSNodeStyleSetFlexWrap(root, CSSWrapWrap); CSSNodeStyleSetFlexWrap(root, YGWrapWrap);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew(); const CSSNodeRef root_child0 = CSSNodeNew();
@@ -201,7 +201,7 @@ TEST(CSSLayoutTest, wrap_row_align_items_flex_end) {
CSSNodeStyleSetWidth(root_child3, 30); CSSNodeStyleSetWidth(root_child3, 30);
CSSNodeStyleSetHeight(root_child3, 30); CSSNodeStyleSetHeight(root_child3, 30);
CSSNodeInsertChild(root, root_child3, 3); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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, CSSNodeLayoutGetWidth(root_child3));
ASSERT_FLOAT_EQ(30, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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) { TEST(CSSLayoutTest, wrap_row_align_items_center) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetAlignItems(root, CSSAlignCenter); CSSNodeStyleSetAlignItems(root, YGAlignCenter);
CSSNodeStyleSetFlexWrap(root, CSSWrapWrap); CSSNodeStyleSetFlexWrap(root, YGWrapWrap);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew(); const CSSNodeRef root_child0 = CSSNodeNew();
@@ -284,7 +284,7 @@ TEST(CSSLayoutTest, wrap_row_align_items_center) {
CSSNodeStyleSetWidth(root_child3, 30); CSSNodeStyleSetWidth(root_child3, 30);
CSSNodeStyleSetHeight(root_child3, 30); CSSNodeStyleSetHeight(root_child3, 30);
CSSNodeInsertChild(root, root_child3, 3); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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, CSSNodeLayoutGetWidth(root_child3));
ASSERT_FLOAT_EQ(30, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));

View File

@@ -14,7 +14,7 @@
TEST(CSSLayoutTest, justify_content_row_flex_start) { TEST(CSSLayoutTest, justify_content_row_flex_start) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetWidth(root, 102); CSSNodeStyleSetWidth(root, 102);
CSSNodeStyleSetHeight(root, 102); CSSNodeStyleSetHeight(root, 102);
@@ -29,7 +29,7 @@ TEST(CSSLayoutTest, justify_content_row_flex_start) {
const CSSNodeRef root_child2 = CSSNodeNew(); const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetWidth(root_child2, 10); CSSNodeStyleSetWidth(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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(10, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(102, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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) { TEST(CSSLayoutTest, justify_content_row_flex_end) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetJustifyContent(root, CSSJustifyFlexEnd); CSSNodeStyleSetJustifyContent(root, YGJustifyFlexEnd);
CSSNodeStyleSetWidth(root, 102); CSSNodeStyleSetWidth(root, 102);
CSSNodeStyleSetHeight(root, 102); CSSNodeStyleSetHeight(root, 102);
@@ -94,7 +94,7 @@ TEST(CSSLayoutTest, justify_content_row_flex_end) {
const CSSNodeRef root_child2 = CSSNodeNew(); const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetWidth(root_child2, 10); CSSNodeStyleSetWidth(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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(10, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(102, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -143,8 +143,8 @@ TEST(CSSLayoutTest, justify_content_row_flex_end) {
TEST(CSSLayoutTest, justify_content_row_center) { TEST(CSSLayoutTest, justify_content_row_center) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetJustifyContent(root, CSSJustifyCenter); CSSNodeStyleSetJustifyContent(root, YGJustifyCenter);
CSSNodeStyleSetWidth(root, 102); CSSNodeStyleSetWidth(root, 102);
CSSNodeStyleSetHeight(root, 102); CSSNodeStyleSetHeight(root, 102);
@@ -159,7 +159,7 @@ TEST(CSSLayoutTest, justify_content_row_center) {
const CSSNodeRef root_child2 = CSSNodeNew(); const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetWidth(root_child2, 10); CSSNodeStyleSetWidth(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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(10, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(102, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -208,8 +208,8 @@ TEST(CSSLayoutTest, justify_content_row_center) {
TEST(CSSLayoutTest, justify_content_row_space_between) { TEST(CSSLayoutTest, justify_content_row_space_between) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetJustifyContent(root, CSSJustifySpaceBetween); CSSNodeStyleSetJustifyContent(root, YGJustifySpaceBetween);
CSSNodeStyleSetWidth(root, 102); CSSNodeStyleSetWidth(root, 102);
CSSNodeStyleSetHeight(root, 102); CSSNodeStyleSetHeight(root, 102);
@@ -224,7 +224,7 @@ TEST(CSSLayoutTest, justify_content_row_space_between) {
const CSSNodeRef root_child2 = CSSNodeNew(); const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetWidth(root_child2, 10); CSSNodeStyleSetWidth(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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(10, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(102, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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) { TEST(CSSLayoutTest, justify_content_row_space_around) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetJustifyContent(root, CSSJustifySpaceAround); CSSNodeStyleSetJustifyContent(root, YGJustifySpaceAround);
CSSNodeStyleSetWidth(root, 102); CSSNodeStyleSetWidth(root, 102);
CSSNodeStyleSetHeight(root, 102); CSSNodeStyleSetHeight(root, 102);
@@ -289,7 +289,7 @@ TEST(CSSLayoutTest, justify_content_row_space_around) {
const CSSNodeRef root_child2 = CSSNodeNew(); const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetWidth(root_child2, 10); CSSNodeStyleSetWidth(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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(10, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(102, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -351,7 +351,7 @@ TEST(CSSLayoutTest, justify_content_column_flex_start) {
const CSSNodeRef root_child2 = CSSNodeNew(); const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetHeight(root_child2, 10); CSSNodeStyleSetHeight(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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(102, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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) { TEST(CSSLayoutTest, justify_content_column_flex_end) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetJustifyContent(root, CSSJustifyFlexEnd); CSSNodeStyleSetJustifyContent(root, YGJustifyFlexEnd);
CSSNodeStyleSetWidth(root, 102); CSSNodeStyleSetWidth(root, 102);
CSSNodeStyleSetHeight(root, 102); CSSNodeStyleSetHeight(root, 102);
@@ -415,7 +415,7 @@ TEST(CSSLayoutTest, justify_content_column_flex_end) {
const CSSNodeRef root_child2 = CSSNodeNew(); const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetHeight(root_child2, 10); CSSNodeStyleSetHeight(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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(102, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -464,7 +464,7 @@ TEST(CSSLayoutTest, justify_content_column_flex_end) {
TEST(CSSLayoutTest, justify_content_column_center) { TEST(CSSLayoutTest, justify_content_column_center) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetJustifyContent(root, CSSJustifyCenter); CSSNodeStyleSetJustifyContent(root, YGJustifyCenter);
CSSNodeStyleSetWidth(root, 102); CSSNodeStyleSetWidth(root, 102);
CSSNodeStyleSetHeight(root, 102); CSSNodeStyleSetHeight(root, 102);
@@ -479,7 +479,7 @@ TEST(CSSLayoutTest, justify_content_column_center) {
const CSSNodeRef root_child2 = CSSNodeNew(); const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetHeight(root_child2, 10); CSSNodeStyleSetHeight(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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(102, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -528,7 +528,7 @@ TEST(CSSLayoutTest, justify_content_column_center) {
TEST(CSSLayoutTest, justify_content_column_space_between) { TEST(CSSLayoutTest, justify_content_column_space_between) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetJustifyContent(root, CSSJustifySpaceBetween); CSSNodeStyleSetJustifyContent(root, YGJustifySpaceBetween);
CSSNodeStyleSetWidth(root, 102); CSSNodeStyleSetWidth(root, 102);
CSSNodeStyleSetHeight(root, 102); CSSNodeStyleSetHeight(root, 102);
@@ -543,7 +543,7 @@ TEST(CSSLayoutTest, justify_content_column_space_between) {
const CSSNodeRef root_child2 = CSSNodeNew(); const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetHeight(root_child2, 10); CSSNodeStyleSetHeight(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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(102, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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) { TEST(CSSLayoutTest, justify_content_column_space_around) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetJustifyContent(root, CSSJustifySpaceAround); CSSNodeStyleSetJustifyContent(root, YGJustifySpaceAround);
CSSNodeStyleSetWidth(root, 102); CSSNodeStyleSetWidth(root, 102);
CSSNodeStyleSetHeight(root, 102); CSSNodeStyleSetHeight(root, 102);
@@ -607,7 +607,7 @@ TEST(CSSLayoutTest, justify_content_column_space_around) {
const CSSNodeRef root_child2 = CSSNodeNew(); const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetHeight(root_child2, 10); CSSNodeStyleSetHeight(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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(102, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));

View File

@@ -14,15 +14,15 @@
TEST(CSSLayoutTest, margin_start) { TEST(CSSLayoutTest, margin_start) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew(); const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetMargin(root_child0, CSSEdgeStart, 10); CSSNodeStyleSetMargin(root_child0, YGEdgeStart, 10);
CSSNodeStyleSetWidth(root_child0, 10); CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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(10, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -55,10 +55,10 @@ TEST(CSSLayoutTest, margin_top) {
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew(); const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetMargin(root_child0, CSSEdgeTop, 10); CSSNodeStyleSetMargin(root_child0, YGEdgeTop, 10);
CSSNodeStyleSetHeight(root_child0, 10); CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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(100, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -87,16 +87,16 @@ TEST(CSSLayoutTest, margin_top) {
TEST(CSSLayoutTest, margin_end) { TEST(CSSLayoutTest, margin_end) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetJustifyContent(root, CSSJustifyFlexEnd); CSSNodeStyleSetJustifyContent(root, YGJustifyFlexEnd);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew(); const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetMargin(root_child0, CSSEdgeEnd, 10); CSSNodeStyleSetMargin(root_child0, YGEdgeEnd, 10);
CSSNodeStyleSetWidth(root_child0, 10); CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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(10, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -125,15 +125,15 @@ TEST(CSSLayoutTest, margin_end) {
TEST(CSSLayoutTest, margin_bottom) { TEST(CSSLayoutTest, margin_bottom) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetJustifyContent(root, CSSJustifyFlexEnd); CSSNodeStyleSetJustifyContent(root, YGJustifyFlexEnd);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew(); const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetMargin(root_child0, CSSEdgeBottom, 10); CSSNodeStyleSetMargin(root_child0, YGEdgeBottom, 10);
CSSNodeStyleSetHeight(root_child0, 10); CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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(100, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -162,15 +162,15 @@ TEST(CSSLayoutTest, margin_bottom) {
TEST(CSSLayoutTest, margin_and_flex_row) { TEST(CSSLayoutTest, margin_and_flex_row) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew(); const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child0, 1); CSSNodeStyleSetFlexGrow(root_child0, 1);
CSSNodeStyleSetMargin(root_child0, CSSEdgeStart, 10); CSSNodeStyleSetMargin(root_child0, YGEdgeStart, 10);
CSSNodeInsertChild(root, root_child0, 0); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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(90, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -204,9 +204,9 @@ TEST(CSSLayoutTest, margin_and_flex_column) {
const CSSNodeRef root_child0 = CSSNodeNew(); const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child0, 1); CSSNodeStyleSetFlexGrow(root_child0, 1);
CSSNodeStyleSetMargin(root_child0, CSSEdgeTop, 10); CSSNodeStyleSetMargin(root_child0, YGEdgeTop, 10);
CSSNodeInsertChild(root, root_child0, 0); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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(100, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(90, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -235,15 +235,15 @@ TEST(CSSLayoutTest, margin_and_flex_column) {
TEST(CSSLayoutTest, margin_and_stretch_row) { TEST(CSSLayoutTest, margin_and_stretch_row) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew(); const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child0, 1); CSSNodeStyleSetFlexGrow(root_child0, 1);
CSSNodeStyleSetMargin(root_child0, CSSEdgeTop, 10); CSSNodeStyleSetMargin(root_child0, YGEdgeTop, 10);
CSSNodeInsertChild(root, root_child0, 0); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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(100, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(90, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -277,9 +277,9 @@ TEST(CSSLayoutTest, margin_and_stretch_column) {
const CSSNodeRef root_child0 = CSSNodeNew(); const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child0, 1); CSSNodeStyleSetFlexGrow(root_child0, 1);
CSSNodeStyleSetMargin(root_child0, CSSEdgeStart, 10); CSSNodeStyleSetMargin(root_child0, YGEdgeStart, 10);
CSSNodeInsertChild(root, root_child0, 0); 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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(90, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -308,7 +308,7 @@ TEST(CSSLayoutTest, margin_and_stretch_column) {
TEST(CSSLayoutTest, margin_with_sibling_row) { TEST(CSSLayoutTest, margin_with_sibling_row) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
@@ -319,7 +319,7 @@ TEST(CSSLayoutTest, margin_with_sibling_row) {
const CSSNodeRef root_child1 = CSSNodeNew(); const CSSNodeRef root_child1 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child1, 1); CSSNodeStyleSetFlexGrow(root_child1, 1);
CSSNodeInsertChild(root, 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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(50, CSSNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -368,7 +368,7 @@ TEST(CSSLayoutTest, margin_with_sibling_column) {
const CSSNodeRef root_child1 = CSSNodeNew(); const CSSNodeRef root_child1 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child1, 1); CSSNodeStyleSetFlexGrow(root_child1, 1);
CSSNodeInsertChild(root, 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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(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(100, CSSNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetHeight(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, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root)); ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));

View File

@@ -12,37 +12,37 @@
static CSSSize _measureMax(CSSNodeRef node, static CSSSize _measureMax(CSSNodeRef node,
float width, float width,
CSSMeasureMode widthMode, YGMeasureMode widthMode,
float height, float height,
CSSMeasureMode heightMode) { YGMeasureMode heightMode) {
int *measureCount = (int *)CSSNodeGetContext(node); int *measureCount = (int *)CSSNodeGetContext(node);
(*measureCount)++; (*measureCount)++;
return CSSSize { return CSSSize {
.width = widthMode == CSSMeasureModeUndefined ? 10 : width, .width = widthMode == YGMeasureModeUndefined ? 10 : width,
.height = heightMode == CSSMeasureModeUndefined ? 10 : height, .height = heightMode == YGMeasureModeUndefined ? 10 : height,
}; };
} }
static CSSSize _measureMin(CSSNodeRef node, static CSSSize _measureMin(CSSNodeRef node,
float width, float width,
CSSMeasureMode widthMode, YGMeasureMode widthMode,
float height, float height,
CSSMeasureMode heightMode) { YGMeasureMode heightMode) {
int *measureCount = (int *)CSSNodeGetContext(node); int *measureCount = (int *)CSSNodeGetContext(node);
*measureCount = *measureCount + 1; *measureCount = *measureCount + 1;
return CSSSize { return CSSSize {
.width = widthMode == CSSMeasureModeUndefined || (widthMode == CSSMeasureModeAtMost && width > 10) ? 10 : width, .width = widthMode == YGMeasureModeUndefined || (widthMode == YGMeasureModeAtMost && width > 10) ? 10 : width,
.height = heightMode == CSSMeasureModeUndefined || (heightMode == CSSMeasureModeAtMost && height > 10) ? 10 : height, .height = heightMode == YGMeasureModeUndefined || (heightMode == YGMeasureModeAtMost && height > 10) ? 10 : height,
}; };
} }
TEST(CSSLayoutTest, measure_once_single_flexible_child) { TEST(CSSLayoutTest, measure_once_single_flexible_child) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
@@ -53,7 +53,7 @@ TEST(CSSLayoutTest, measure_once_single_flexible_child) {
CSSNodeStyleSetFlexGrow(root_child0, 1); CSSNodeStyleSetFlexGrow(root_child0, 1);
CSSNodeInsertChild(root, root_child0, 0); CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(1, measureCount); ASSERT_EQ(1, measureCount);
@@ -69,8 +69,8 @@ TEST(CSSLayoutTest, remeasure_with_same_exact_width_larger_than_needed_height) {
CSSNodeSetMeasureFunc(root_child0, _measureMin); CSSNodeSetMeasureFunc(root_child0, _measureMin);
CSSNodeInsertChild(root, root_child0, 0); CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, 100, 100, CSSDirectionLTR); CSSNodeCalculateLayout(root, 100, 100, YGDirectionLTR);
CSSNodeCalculateLayout(root, 100, 50, CSSDirectionLTR); CSSNodeCalculateLayout(root, 100, 50, YGDirectionLTR);
ASSERT_EQ(1, measureCount); 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) { TEST(CSSLayoutTest, remeasure_with_same_atmost_width_larger_than_needed_height) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
const CSSNodeRef root_child0 = CSSNodeNew(); const CSSNodeRef root_child0 = CSSNodeNew();
int measureCount = 0; int measureCount = 0;
@@ -87,8 +87,8 @@ TEST(CSSLayoutTest, remeasure_with_same_atmost_width_larger_than_needed_height)
CSSNodeSetMeasureFunc(root_child0, _measureMin); CSSNodeSetMeasureFunc(root_child0, _measureMin);
CSSNodeInsertChild(root, root_child0, 0); CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, 100, 100, CSSDirectionLTR); CSSNodeCalculateLayout(root, 100, 100, YGDirectionLTR);
CSSNodeCalculateLayout(root, 100, 50, CSSDirectionLTR); CSSNodeCalculateLayout(root, 100, 50, YGDirectionLTR);
ASSERT_EQ(1, measureCount); 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) { TEST(CSSLayoutTest, remeasure_with_computed_width_larger_than_needed_height) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
const CSSNodeRef root_child0 = CSSNodeNew(); const CSSNodeRef root_child0 = CSSNodeNew();
int measureCount = 0; int measureCount = 0;
@@ -105,9 +105,9 @@ TEST(CSSLayoutTest, remeasure_with_computed_width_larger_than_needed_height) {
CSSNodeSetMeasureFunc(root_child0, _measureMin); CSSNodeSetMeasureFunc(root_child0, _measureMin);
CSSNodeInsertChild(root, root_child0, 0); CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, 100, 100, CSSDirectionLTR); CSSNodeCalculateLayout(root, 100, 100, YGDirectionLTR);
CSSNodeStyleSetAlignItems(root, CSSAlignStretch); CSSNodeStyleSetAlignItems(root, YGAlignStretch);
CSSNodeCalculateLayout(root, 10, 50, CSSDirectionLTR); CSSNodeCalculateLayout(root, 10, 50, YGDirectionLTR);
ASSERT_EQ(1, measureCount); 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) { TEST(CSSLayoutTest, remeasure_with_atmost_computed_width_undefined_height) {
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
const CSSNodeRef root_child0 = CSSNodeNew(); const CSSNodeRef root_child0 = CSSNodeNew();
int measureCount = 0; int measureCount = 0;
@@ -124,8 +124,8 @@ TEST(CSSLayoutTest, remeasure_with_atmost_computed_width_undefined_height) {
CSSNodeSetMeasureFunc(root_child0, _measureMin); CSSNodeSetMeasureFunc(root_child0, _measureMin);
CSSNodeInsertChild(root, root_child0, 0); CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, 100, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, 100, YGUndefined, YGDirectionLTR);
CSSNodeCalculateLayout(root, 10, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, 10, YGUndefined, YGDirectionLTR);
ASSERT_EQ(1, measureCount); ASSERT_EQ(1, measureCount);

View File

@@ -12,9 +12,9 @@
struct _MeasureConstraint { struct _MeasureConstraint {
float width; float width;
CSSMeasureMode widthMode; YGMeasureMode widthMode;
float height; float height;
CSSMeasureMode heightMode; YGMeasureMode heightMode;
}; };
struct _MeasureConstraintList { struct _MeasureConstraintList {
@@ -24,9 +24,9 @@ struct _MeasureConstraintList {
static CSSSize _measure(CSSNodeRef node, static CSSSize _measure(CSSNodeRef node,
float width, float width,
CSSMeasureMode widthMode, YGMeasureMode widthMode,
float height, float height,
CSSMeasureMode heightMode) { YGMeasureMode heightMode) {
struct _MeasureConstraintList *constraintList = (struct _MeasureConstraintList *)CSSNodeGetContext(node); struct _MeasureConstraintList *constraintList = (struct _MeasureConstraintList *)CSSNodeGetContext(node);
struct _MeasureConstraint *constraints = constraintList->constraints; struct _MeasureConstraint *constraints = constraintList->constraints;
uint32_t currentIndex = constraintList->length; uint32_t currentIndex = constraintList->length;
@@ -37,8 +37,8 @@ static CSSSize _measure(CSSNodeRef node,
constraintList->length = currentIndex + 1; constraintList->length = currentIndex + 1;
return CSSSize { return CSSSize {
.width = widthMode == CSSMeasureModeUndefined ? 10 : width, .width = widthMode == YGMeasureModeUndefined ? 10 : width,
.height = heightMode == CSSMeasureModeUndefined ? 10 : width, .height = heightMode == YGMeasureModeUndefined ? 10 : width,
}; };
} }
@@ -57,12 +57,12 @@ TEST(CSSLayoutTest, exactly_measure_stretched_child_column) {
CSSNodeSetMeasureFunc(root_child0, _measure); CSSNodeSetMeasureFunc(root_child0, _measure);
CSSNodeInsertChild(root, root_child0, 0); CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(1, constraintList.length); ASSERT_EQ(1, constraintList.length);
ASSERT_FLOAT_EQ(100, constraintList.constraints[0].width); 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); free(constraintList.constraints);
CSSNodeFreeRecursive(root); CSSNodeFreeRecursive(root);
@@ -75,7 +75,7 @@ TEST(CSSLayoutTest, exactly_measure_stretched_child_row) {
}; };
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
@@ -84,12 +84,12 @@ TEST(CSSLayoutTest, exactly_measure_stretched_child_row) {
CSSNodeSetMeasureFunc(root_child0, _measure); CSSNodeSetMeasureFunc(root_child0, _measure);
CSSNodeInsertChild(root, root_child0, 0); CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(1, constraintList.length); ASSERT_EQ(1, constraintList.length);
ASSERT_FLOAT_EQ(100, constraintList.constraints[0].height); 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); free(constraintList.constraints);
CSSNodeFreeRecursive(root); CSSNodeFreeRecursive(root);
@@ -110,12 +110,12 @@ TEST(CSSLayoutTest, at_most_main_axis_column) {
CSSNodeSetMeasureFunc(root_child0, _measure); CSSNodeSetMeasureFunc(root_child0, _measure);
CSSNodeInsertChild(root, root_child0, 0); CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(1, constraintList.length); ASSERT_EQ(1, constraintList.length);
ASSERT_FLOAT_EQ(100, constraintList.constraints[0].height); 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); free(constraintList.constraints);
CSSNodeFreeRecursive(root); CSSNodeFreeRecursive(root);
@@ -128,7 +128,7 @@ TEST(CSSLayoutTest, at_most_cross_axis_column) {
}; };
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
@@ -137,12 +137,12 @@ TEST(CSSLayoutTest, at_most_cross_axis_column) {
CSSNodeSetMeasureFunc(root_child0, _measure); CSSNodeSetMeasureFunc(root_child0, _measure);
CSSNodeInsertChild(root, root_child0, 0); CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(1, constraintList.length); ASSERT_EQ(1, constraintList.length);
ASSERT_FLOAT_EQ(100, constraintList.constraints[0].width); 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); free(constraintList.constraints);
CSSNodeFreeRecursive(root); CSSNodeFreeRecursive(root);
@@ -155,7 +155,7 @@ TEST(CSSLayoutTest, at_most_main_axis_row) {
}; };
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
@@ -164,12 +164,12 @@ TEST(CSSLayoutTest, at_most_main_axis_row) {
CSSNodeSetMeasureFunc(root_child0, _measure); CSSNodeSetMeasureFunc(root_child0, _measure);
CSSNodeInsertChild(root, root_child0, 0); CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(1, constraintList.length); ASSERT_EQ(1, constraintList.length);
ASSERT_FLOAT_EQ(100, constraintList.constraints[0].width); 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); free(constraintList.constraints);
CSSNodeFreeRecursive(root); CSSNodeFreeRecursive(root);
@@ -182,8 +182,8 @@ TEST(CSSLayoutTest, at_most_cross_axis_row) {
}; };
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
@@ -192,12 +192,12 @@ TEST(CSSLayoutTest, at_most_cross_axis_row) {
CSSNodeSetMeasureFunc(root_child0, _measure); CSSNodeSetMeasureFunc(root_child0, _measure);
CSSNodeInsertChild(root, root_child0, 0); CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(1, constraintList.length); ASSERT_EQ(1, constraintList.length);
ASSERT_FLOAT_EQ(100, constraintList.constraints[0].height); 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); free(constraintList.constraints);
CSSNodeFreeRecursive(root); CSSNodeFreeRecursive(root);
@@ -218,15 +218,15 @@ TEST(CSSLayoutTest, flex_child) {
CSSNodeSetMeasureFunc(root_child0, _measure); CSSNodeSetMeasureFunc(root_child0, _measure);
CSSNodeInsertChild(root, root_child0, 0); CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(2, constraintList.length); ASSERT_EQ(2, constraintList.length);
ASSERT_FLOAT_EQ(100, constraintList.constraints[0].height); 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_FLOAT_EQ(100, constraintList.constraints[1].height);
ASSERT_EQ(CSSMeasureModeExactly, constraintList.constraints[1].heightMode); ASSERT_EQ(YGMeasureModeExactly, constraintList.constraints[1].heightMode);
free(constraintList.constraints); free(constraintList.constraints);
CSSNodeFreeRecursive(root); CSSNodeFreeRecursive(root);
@@ -248,12 +248,12 @@ TEST(CSSLayoutTest, flex_child_with_flex_basis) {
CSSNodeSetMeasureFunc(root_child0, _measure); CSSNodeSetMeasureFunc(root_child0, _measure);
CSSNodeInsertChild(root, root_child0, 0); CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(1, constraintList.length); ASSERT_EQ(1, constraintList.length);
ASSERT_FLOAT_EQ(100, constraintList.constraints[0].height); 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); free(constraintList.constraints);
CSSNodeFreeRecursive(root); CSSNodeFreeRecursive(root);
@@ -266,8 +266,8 @@ TEST(CSSLayoutTest, overflow_scroll_column) {
}; };
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetOverflow(root, CSSOverflowScroll); CSSNodeStyleSetOverflow(root, YGOverflowScroll);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
@@ -276,15 +276,15 @@ TEST(CSSLayoutTest, overflow_scroll_column) {
CSSNodeSetMeasureFunc(root_child0, _measure); CSSNodeSetMeasureFunc(root_child0, _measure);
CSSNodeInsertChild(root, root_child0, 0); CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(1, constraintList.length); ASSERT_EQ(1, constraintList.length);
ASSERT_FLOAT_EQ(100, constraintList.constraints[0].width); 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_TRUE(CSSValueIsUndefined(constraintList.constraints[0].height));
ASSERT_EQ(CSSMeasureModeUndefined, constraintList.constraints[0].heightMode); ASSERT_EQ(YGMeasureModeUndefined, constraintList.constraints[0].heightMode);
free(constraintList.constraints); free(constraintList.constraints);
CSSNodeFreeRecursive(root); CSSNodeFreeRecursive(root);
@@ -297,9 +297,9 @@ TEST(CSSLayoutTest, overflow_scroll_row) {
}; };
const CSSNodeRef root = CSSNodeNew(); const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart); CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow); CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetOverflow(root, CSSOverflowScroll); CSSNodeStyleSetOverflow(root, YGOverflowScroll);
CSSNodeStyleSetHeight(root, 100); CSSNodeStyleSetHeight(root, 100);
CSSNodeStyleSetWidth(root, 100); CSSNodeStyleSetWidth(root, 100);
@@ -308,15 +308,15 @@ TEST(CSSLayoutTest, overflow_scroll_row) {
CSSNodeSetMeasureFunc(root_child0, _measure); CSSNodeSetMeasureFunc(root_child0, _measure);
CSSNodeInsertChild(root, root_child0, 0); CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR); CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_EQ(1, constraintList.length); ASSERT_EQ(1, constraintList.length);
ASSERT_TRUE(CSSValueIsUndefined(constraintList.constraints[0].width)); 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_FLOAT_EQ(100, constraintList.constraints[0].height);
ASSERT_EQ(CSSMeasureModeAtMost, constraintList.constraints[0].heightMode); ASSERT_EQ(YGMeasureModeAtMost, constraintList.constraints[0].heightMode);
free(constraintList.constraints); free(constraintList.constraints);
CSSNodeFreeRecursive(root); CSSNodeFreeRecursive(root);

Some files were not shown because too many files have changed in this diff Show More