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

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)
#endif
#define CSSUndefined NAN
#define YGUndefined NAN
#include "CSSEnums.h"
#include "CSSMacros.h"
@@ -41,11 +41,11 @@ typedef struct CSSSize {
typedef struct CSSNode *CSSNodeRef;
typedef CSSSize (*CSSMeasureFunc)(CSSNodeRef node,
float width,
CSSMeasureMode widthMode,
YGMeasureMode widthMode,
float height,
CSSMeasureMode heightMode);
YGMeasureMode heightMode);
typedef void (*CSSPrintFunc)(CSSNodeRef node);
typedef int (*CSSLogger)(CSSLogLevel level, const char *format, va_list args);
typedef int (*CSSLogger)(YGLogLevel level, const char *format, va_list args);
typedef void *(*CSSMalloc)(size_t size);
typedef void *(*CSSCalloc)(size_t count, size_t size);
@@ -70,7 +70,7 @@ WIN_EXPORT uint32_t CSSNodeChildCount(const CSSNodeRef node);
WIN_EXPORT void CSSNodeCalculateLayout(const CSSNodeRef node,
const float availableWidth,
const float availableHeight,
const CSSDirection parentDirection);
const YGDirection parentDirection);
// Mark a node as dirty. Only valid for nodes with a custom measure function
// set.
@@ -81,17 +81,17 @@ WIN_EXPORT void CSSNodeCalculateLayout(const CSSNodeRef node,
WIN_EXPORT void CSSNodeMarkDirty(const CSSNodeRef node);
WIN_EXPORT bool CSSNodeIsDirty(const CSSNodeRef node);
WIN_EXPORT void CSSNodePrint(const CSSNodeRef node, const CSSPrintOptions options);
WIN_EXPORT void CSSNodePrint(const CSSNodeRef node, const YGPrintOptions options);
WIN_EXPORT bool CSSValueIsUndefined(const float value);
WIN_EXPORT bool CSSNodeCanUseCachedMeasurement(const CSSMeasureMode widthMode,
WIN_EXPORT bool CSSNodeCanUseCachedMeasurement(const YGMeasureMode widthMode,
const float width,
const CSSMeasureMode heightMode,
const YGMeasureMode heightMode,
const float height,
const CSSMeasureMode lastWidthMode,
const YGMeasureMode lastWidthMode,
const float lastWidth,
const CSSMeasureMode lastHeightMode,
const YGMeasureMode lastHeightMode,
const float lastHeight,
const float lastComputedWidth,
const float lastComputedHeight,
@@ -110,9 +110,9 @@ WIN_EXPORT void CSSNodeCopyStyle(const CSSNodeRef dstNode, const CSSNodeRef srcN
#define CSS_NODE_STYLE_EDGE_PROPERTY(type, name, paramName) \
WIN_EXPORT void CSSNodeStyleSet##name(const CSSNodeRef node, \
const CSSEdge edge, \
const YGEdge edge, \
const type paramName); \
WIN_EXPORT type CSSNodeStyleGet##name(const CSSNodeRef node, const CSSEdge edge);
WIN_EXPORT type CSSNodeStyleGet##name(const CSSNodeRef node, const YGEdge edge);
#define CSS_NODE_LAYOUT_PROPERTY(type, name) \
WIN_EXPORT type CSSNodeLayoutGet##name(const CSSNodeRef node);
@@ -122,15 +122,15 @@ CSS_NODE_PROPERTY(CSSMeasureFunc, MeasureFunc, measureFunc);
CSS_NODE_PROPERTY(CSSPrintFunc, PrintFunc, printFunc);
CSS_NODE_PROPERTY(bool, HasNewLayout, hasNewLayout);
CSS_NODE_STYLE_PROPERTY(CSSDirection, Direction, direction);
CSS_NODE_STYLE_PROPERTY(CSSFlexDirection, FlexDirection, flexDirection);
CSS_NODE_STYLE_PROPERTY(CSSJustify, JustifyContent, justifyContent);
CSS_NODE_STYLE_PROPERTY(CSSAlign, AlignContent, alignContent);
CSS_NODE_STYLE_PROPERTY(CSSAlign, AlignItems, alignItems);
CSS_NODE_STYLE_PROPERTY(CSSAlign, AlignSelf, alignSelf);
CSS_NODE_STYLE_PROPERTY(CSSPositionType, PositionType, positionType);
CSS_NODE_STYLE_PROPERTY(CSSWrap, FlexWrap, flexWrap);
CSS_NODE_STYLE_PROPERTY(CSSOverflow, Overflow, overflow);
CSS_NODE_STYLE_PROPERTY(YGDirection, Direction, direction);
CSS_NODE_STYLE_PROPERTY(YGFlexDirection, FlexDirection, flexDirection);
CSS_NODE_STYLE_PROPERTY(YGJustify, JustifyContent, justifyContent);
CSS_NODE_STYLE_PROPERTY(YGAlign, AlignContent, alignContent);
CSS_NODE_STYLE_PROPERTY(YGAlign, AlignItems, alignItems);
CSS_NODE_STYLE_PROPERTY(YGAlign, AlignSelf, alignSelf);
CSS_NODE_STYLE_PROPERTY(YGPositionType, PositionType, positionType);
CSS_NODE_STYLE_PROPERTY(YGWrap, FlexWrap, flexWrap);
CSS_NODE_STYLE_PROPERTY(YGOverflow, Overflow, overflow);
WIN_EXPORT void CSSNodeStyleSetFlex(const CSSNodeRef node, const float flex);
CSS_NODE_STYLE_PROPERTY(float, FlexGrow, flexGrow);
@@ -167,14 +167,13 @@ CSS_NODE_LAYOUT_PROPERTY(float, Right);
CSS_NODE_LAYOUT_PROPERTY(float, Bottom);
CSS_NODE_LAYOUT_PROPERTY(float, Width);
CSS_NODE_LAYOUT_PROPERTY(float, Height);
CSS_NODE_LAYOUT_PROPERTY(CSSDirection, Direction);
CSS_NODE_LAYOUT_PROPERTY(YGDirection, Direction);
WIN_EXPORT void CSSLayoutSetLogger(CSSLogger logger);
WIN_EXPORT void CSSLog(CSSLogLevel level, const char *message, ...);
WIN_EXPORT void CSSLog(YGLogLevel level, const char *message, ...);
WIN_EXPORT void CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeature feature,
bool enabled);
WIN_EXPORT bool CSSLayoutIsExperimentalFeatureEnabled(CSSExperimentalFeature feature);
WIN_EXPORT void CSSLayoutSetExperimentalFeatureEnabled(YGExperimentalFeature feature, bool enabled);
WIN_EXPORT bool CSSLayoutIsExperimentalFeatureEnabled(YGExperimentalFeature feature);
WIN_EXPORT void CSSLayoutSetMemoryFuncs(CSSMalloc cssMalloc,
CSSCalloc cssCalloc,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -11,7 +11,7 @@
static CSSInteropLoggerFunc gManagedFunc;
static int unmanagedLogger(CSSLogLevel level, const char *format, va_list args) {
static int unmanagedLogger(YGLogLevel level, const char *format, va_list args) {
int result = 0;
if (gManagedFunc) {
char buffer[256];

View File

@@ -13,7 +13,7 @@
CSS_EXTERN_C_BEGIN
typedef void (*CSSInteropLoggerFunc)(CSSLogLevel level, const char *message);
typedef void (*CSSInteropLoggerFunc)(YGLogLevel level, const char *message);
WIN_EXPORT void CSSInteropSetLogger(CSSInteropLoggerFunc managedFunc);

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

View File

@@ -14,9 +14,9 @@ namespace Facebook.CSSLayout
{
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public delegate CSSSize CSSMeasureFunc(
IntPtr node,
IntPtr node,
float width,
CSSMeasureMode widthMode,
YogaMeasureMode widthMode,
float height,
CSSMeasureMode heightMode);
YogaMeasureMode heightMode);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -9,7 +9,7 @@
namespace Facebook.CSSLayout
{
public enum CSSDimension
public enum YogaDimension
{
Width,
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
{
public enum CSSEdge
public enum YogaEdge
{
Left,
Top,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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);
* See CSSLogLevel for the different log levels.
* See YogaLogLevel for the different log levels.
*/
@DoNotStrip
public interface CSSLogger {
@DoNotStrip
void log(CSSLogLevel level, String message);
void log(YogaLogLevel level, String message);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -18,13 +18,13 @@ TEST(CSSLayoutTest, absolute_layout_width_height_start_top) {
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetPositionType(root_child0, CSSPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child0, CSSEdgeStart, 10);
CSSNodeStyleSetPosition(root_child0, CSSEdgeTop, 10);
CSSNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child0, YGEdgeStart, 10);
CSSNodeStyleSetPosition(root_child0, YGEdgeTop, 10);
CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -36,7 +36,7 @@ TEST(CSSLayoutTest, absolute_layout_width_height_start_top) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -57,13 +57,13 @@ TEST(CSSLayoutTest, absolute_layout_width_height_end_bottom) {
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetPositionType(root_child0, CSSPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child0, CSSEdgeEnd, 10);
CSSNodeStyleSetPosition(root_child0, CSSEdgeBottom, 10);
CSSNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child0, YGEdgeEnd, 10);
CSSNodeStyleSetPosition(root_child0, YGEdgeBottom, 10);
CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -75,7 +75,7 @@ TEST(CSSLayoutTest, absolute_layout_width_height_end_bottom) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -96,13 +96,13 @@ TEST(CSSLayoutTest, absolute_layout_start_top_end_bottom) {
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetPositionType(root_child0, CSSPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child0, CSSEdgeStart, 10);
CSSNodeStyleSetPosition(root_child0, CSSEdgeTop, 10);
CSSNodeStyleSetPosition(root_child0, CSSEdgeEnd, 10);
CSSNodeStyleSetPosition(root_child0, CSSEdgeBottom, 10);
CSSNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child0, YGEdgeStart, 10);
CSSNodeStyleSetPosition(root_child0, YGEdgeTop, 10);
CSSNodeStyleSetPosition(root_child0, YGEdgeEnd, 10);
CSSNodeStyleSetPosition(root_child0, YGEdgeBottom, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -114,7 +114,7 @@ TEST(CSSLayoutTest, absolute_layout_start_top_end_bottom) {
ASSERT_FLOAT_EQ(80, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(80, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -135,15 +135,15 @@ TEST(CSSLayoutTest, absolute_layout_width_height_start_top_end_bottom) {
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetPositionType(root_child0, CSSPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child0, CSSEdgeStart, 10);
CSSNodeStyleSetPosition(root_child0, CSSEdgeTop, 10);
CSSNodeStyleSetPosition(root_child0, CSSEdgeEnd, 10);
CSSNodeStyleSetPosition(root_child0, CSSEdgeBottom, 10);
CSSNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child0, YGEdgeStart, 10);
CSSNodeStyleSetPosition(root_child0, YGEdgeTop, 10);
CSSNodeStyleSetPosition(root_child0, YGEdgeEnd, 10);
CSSNodeStyleSetPosition(root_child0, YGEdgeBottom, 10);
CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -155,7 +155,7 @@ TEST(CSSLayoutTest, absolute_layout_width_height_start_top_end_bottom) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -172,22 +172,22 @@ TEST(CSSLayoutTest, absolute_layout_width_height_start_top_end_bottom) {
TEST(CSSLayoutTest, do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetOverflow(root, CSSOverflowHidden);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetOverflow(root, YGOverflowHidden);
CSSNodeStyleSetWidth(root, 50);
CSSNodeStyleSetHeight(root, 50);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetPositionType(root_child0, CSSPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child0, CSSEdgeStart, 0);
CSSNodeStyleSetPosition(root_child0, CSSEdgeTop, 0);
CSSNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child0, YGEdgeStart, 0);
CSSNodeStyleSetPosition(root_child0, YGEdgeTop, 0);
CSSNodeInsertChild(root, root_child0, 0);
const CSSNodeRef root_child0_child0 = CSSNodeNew();
CSSNodeStyleSetWidth(root_child0_child0, 100);
CSSNodeStyleSetHeight(root_child0_child0, 100);
CSSNodeInsertChild(root_child0, root_child0_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -204,7 +204,7 @@ TEST(CSSLayoutTest, do_not_clamp_height_of_absolute_node_to_height_of_its_overfl
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child0_child0));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child0_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -226,37 +226,37 @@ TEST(CSSLayoutTest, do_not_clamp_height_of_absolute_node_to_height_of_its_overfl
TEST(CSSLayoutTest, absolute_layout_within_border) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetMargin(root, CSSEdgeLeft, 10);
CSSNodeStyleSetMargin(root, CSSEdgeTop, 10);
CSSNodeStyleSetMargin(root, CSSEdgeRight, 10);
CSSNodeStyleSetMargin(root, CSSEdgeBottom, 10);
CSSNodeStyleSetPadding(root, CSSEdgeLeft, 10);
CSSNodeStyleSetPadding(root, CSSEdgeTop, 10);
CSSNodeStyleSetPadding(root, CSSEdgeRight, 10);
CSSNodeStyleSetPadding(root, CSSEdgeBottom, 10);
CSSNodeStyleSetBorder(root, CSSEdgeLeft, 10);
CSSNodeStyleSetBorder(root, CSSEdgeTop, 10);
CSSNodeStyleSetBorder(root, CSSEdgeRight, 10);
CSSNodeStyleSetBorder(root, CSSEdgeBottom, 10);
CSSNodeStyleSetMargin(root, YGEdgeLeft, 10);
CSSNodeStyleSetMargin(root, YGEdgeTop, 10);
CSSNodeStyleSetMargin(root, YGEdgeRight, 10);
CSSNodeStyleSetMargin(root, YGEdgeBottom, 10);
CSSNodeStyleSetPadding(root, YGEdgeLeft, 10);
CSSNodeStyleSetPadding(root, YGEdgeTop, 10);
CSSNodeStyleSetPadding(root, YGEdgeRight, 10);
CSSNodeStyleSetPadding(root, YGEdgeBottom, 10);
CSSNodeStyleSetBorder(root, YGEdgeLeft, 10);
CSSNodeStyleSetBorder(root, YGEdgeTop, 10);
CSSNodeStyleSetBorder(root, YGEdgeRight, 10);
CSSNodeStyleSetBorder(root, YGEdgeBottom, 10);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetPositionType(root_child0, CSSPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child0, CSSEdgeLeft, 0);
CSSNodeStyleSetPosition(root_child0, CSSEdgeTop, 0);
CSSNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child0, YGEdgeLeft, 0);
CSSNodeStyleSetPosition(root_child0, YGEdgeTop, 0);
CSSNodeStyleSetWidth(root_child0, 50);
CSSNodeStyleSetHeight(root_child0, 50);
CSSNodeInsertChild(root, root_child0, 0);
const CSSNodeRef root_child1 = CSSNodeNew();
CSSNodeStyleSetPositionType(root_child1, CSSPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child1, CSSEdgeRight, 0);
CSSNodeStyleSetPosition(root_child1, CSSEdgeBottom, 0);
CSSNodeStyleSetPositionType(root_child1, YGPositionTypeAbsolute);
CSSNodeStyleSetPosition(root_child1, YGEdgeRight, 0);
CSSNodeStyleSetPosition(root_child1, YGEdgeBottom, 0);
CSSNodeStyleSetWidth(root_child1, 50);
CSSNodeStyleSetHeight(root_child1, 50);
CSSNodeInsertChild(root, root_child1, 1);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetTop(root));
@@ -273,7 +273,7 @@ TEST(CSSLayoutTest, absolute_layout_within_border) {
ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetHeight(root_child1));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetTop(root));

View File

@@ -14,7 +14,7 @@
TEST(CSSLayoutTest, align_content_flex_start) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexWrap(root, CSSWrapWrap);
CSSNodeStyleSetFlexWrap(root, YGWrapWrap);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -42,7 +42,7 @@ TEST(CSSLayoutTest, align_content_flex_start) {
CSSNodeStyleSetWidth(root_child4, 50);
CSSNodeStyleSetHeight(root_child4, 10);
CSSNodeInsertChild(root, root_child4, 4);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -74,7 +74,7 @@ TEST(CSSLayoutTest, align_content_flex_start) {
ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetWidth(root_child4));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child4));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -111,8 +111,8 @@ TEST(CSSLayoutTest, align_content_flex_start) {
TEST(CSSLayoutTest, align_content_flex_end) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignContent(root, CSSAlignFlexEnd);
CSSNodeStyleSetFlexWrap(root, CSSWrapWrap);
CSSNodeStyleSetAlignContent(root, YGAlignFlexEnd);
CSSNodeStyleSetFlexWrap(root, YGWrapWrap);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -140,7 +140,7 @@ TEST(CSSLayoutTest, align_content_flex_end) {
CSSNodeStyleSetWidth(root_child4, 50);
CSSNodeStyleSetHeight(root_child4, 10);
CSSNodeInsertChild(root, root_child4, 4);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -172,7 +172,7 @@ TEST(CSSLayoutTest, align_content_flex_end) {
ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetWidth(root_child4));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child4));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -209,8 +209,8 @@ TEST(CSSLayoutTest, align_content_flex_end) {
TEST(CSSLayoutTest, align_content_center) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignContent(root, CSSAlignCenter);
CSSNodeStyleSetFlexWrap(root, CSSWrapWrap);
CSSNodeStyleSetAlignContent(root, YGAlignCenter);
CSSNodeStyleSetFlexWrap(root, YGWrapWrap);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -238,7 +238,7 @@ TEST(CSSLayoutTest, align_content_center) {
CSSNodeStyleSetWidth(root_child4, 50);
CSSNodeStyleSetHeight(root_child4, 10);
CSSNodeInsertChild(root, root_child4, 4);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -270,7 +270,7 @@ TEST(CSSLayoutTest, align_content_center) {
ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetWidth(root_child4));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child4));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -307,8 +307,8 @@ TEST(CSSLayoutTest, align_content_center) {
TEST(CSSLayoutTest, align_content_stretch) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignContent(root, CSSAlignStretch);
CSSNodeStyleSetFlexWrap(root, CSSWrapWrap);
CSSNodeStyleSetAlignContent(root, YGAlignStretch);
CSSNodeStyleSetFlexWrap(root, YGWrapWrap);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -331,7 +331,7 @@ TEST(CSSLayoutTest, align_content_stretch) {
const CSSNodeRef root_child4 = CSSNodeNew();
CSSNodeStyleSetWidth(root_child4, 50);
CSSNodeInsertChild(root, root_child4, 4);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -363,7 +363,7 @@ TEST(CSSLayoutTest, align_content_stretch) {
ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetWidth(root_child4));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetHeight(root_child4));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));

View File

@@ -20,7 +20,7 @@ TEST(CSSLayoutTest, align_items_stretch) {
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -32,7 +32,7 @@ TEST(CSSLayoutTest, align_items_stretch) {
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -49,7 +49,7 @@ TEST(CSSLayoutTest, align_items_stretch) {
TEST(CSSLayoutTest, align_items_center) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignCenter);
CSSNodeStyleSetAlignItems(root, YGAlignCenter);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -57,7 +57,7 @@ TEST(CSSLayoutTest, align_items_center) {
CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -69,7 +69,7 @@ TEST(CSSLayoutTest, align_items_center) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -86,7 +86,7 @@ TEST(CSSLayoutTest, align_items_center) {
TEST(CSSLayoutTest, align_items_flex_start) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart);
CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -94,7 +94,7 @@ TEST(CSSLayoutTest, align_items_flex_start) {
CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -106,7 +106,7 @@ TEST(CSSLayoutTest, align_items_flex_start) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -123,7 +123,7 @@ TEST(CSSLayoutTest, align_items_flex_start) {
TEST(CSSLayoutTest, align_items_flex_end) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexEnd);
CSSNodeStyleSetAlignItems(root, YGAlignFlexEnd);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -131,7 +131,7 @@ TEST(CSSLayoutTest, align_items_flex_end) {
CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -143,7 +143,7 @@ TEST(CSSLayoutTest, align_items_flex_end) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));

View File

@@ -18,11 +18,11 @@ TEST(CSSLayoutTest, align_self_center) {
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetAlignSelf(root_child0, CSSAlignCenter);
CSSNodeStyleSetAlignSelf(root_child0, YGAlignCenter);
CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -34,7 +34,7 @@ TEST(CSSLayoutTest, align_self_center) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -55,11 +55,11 @@ TEST(CSSLayoutTest, align_self_flex_end) {
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetAlignSelf(root_child0, CSSAlignFlexEnd);
CSSNodeStyleSetAlignSelf(root_child0, YGAlignFlexEnd);
CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -71,7 +71,7 @@ TEST(CSSLayoutTest, align_self_flex_end) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -92,11 +92,11 @@ TEST(CSSLayoutTest, align_self_flex_start) {
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetAlignSelf(root_child0, CSSAlignFlexStart);
CSSNodeStyleSetAlignSelf(root_child0, YGAlignFlexStart);
CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -108,7 +108,7 @@ TEST(CSSLayoutTest, align_self_flex_start) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -125,16 +125,16 @@ TEST(CSSLayoutTest, align_self_flex_start) {
TEST(CSSLayoutTest, align_self_flex_end_override_flex_start) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetAlignItems(root, CSSAlignFlexStart);
CSSNodeStyleSetAlignItems(root, YGAlignFlexStart);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetAlignSelf(root_child0, CSSAlignFlexEnd);
CSSNodeStyleSetAlignSelf(root_child0, YGAlignFlexEnd);
CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -146,7 +146,7 @@ TEST(CSSLayoutTest, align_self_flex_end_override_flex_start) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -27,7 +27,7 @@ TEST(CSSLayoutTest, flex_direction_column_no_height) {
const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetHeight(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -49,7 +49,7 @@ TEST(CSSLayoutTest, flex_direction_column_no_height) {
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -76,7 +76,7 @@ TEST(CSSLayoutTest, flex_direction_column_no_height) {
TEST(CSSLayoutTest, flex_direction_row_no_width) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
@@ -90,7 +90,7 @@ TEST(CSSLayoutTest, flex_direction_row_no_width) {
const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetWidth(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -112,7 +112,7 @@ TEST(CSSLayoutTest, flex_direction_row_no_width) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -153,7 +153,7 @@ TEST(CSSLayoutTest, flex_direction_column) {
const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetHeight(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -175,7 +175,7 @@ TEST(CSSLayoutTest, flex_direction_column) {
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -202,7 +202,7 @@ TEST(CSSLayoutTest, flex_direction_column) {
TEST(CSSLayoutTest, flex_direction_row) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -217,7 +217,7 @@ TEST(CSSLayoutTest, flex_direction_row) {
const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetWidth(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -239,7 +239,7 @@ TEST(CSSLayoutTest, flex_direction_row) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -266,7 +266,7 @@ TEST(CSSLayoutTest, flex_direction_row) {
TEST(CSSLayoutTest, flex_direction_column_reverse) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionColumnReverse);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionColumnReverse);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -281,7 +281,7 @@ TEST(CSSLayoutTest, flex_direction_column_reverse) {
const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetHeight(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -303,7 +303,7 @@ TEST(CSSLayoutTest, flex_direction_column_reverse) {
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -330,7 +330,7 @@ TEST(CSSLayoutTest, flex_direction_column_reverse) {
TEST(CSSLayoutTest, flex_direction_row_reverse) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRowReverse);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRowReverse);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -345,7 +345,7 @@ TEST(CSSLayoutTest, flex_direction_row_reverse) {
const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetWidth(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -367,7 +367,7 @@ TEST(CSSLayoutTest, flex_direction_row_reverse) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));

View File

@@ -25,7 +25,7 @@ TEST(CSSLayoutTest, flex_basis_flex_grow_column) {
const CSSNodeRef root_child1 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child1, 1);
CSSNodeInsertChild(root, root_child1, 1);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -42,7 +42,7 @@ TEST(CSSLayoutTest, flex_basis_flex_grow_column) {
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(25, CSSNodeLayoutGetHeight(root_child1));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -64,7 +64,7 @@ TEST(CSSLayoutTest, flex_basis_flex_grow_column) {
TEST(CSSLayoutTest, flex_basis_flex_grow_row) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -76,7 +76,7 @@ TEST(CSSLayoutTest, flex_basis_flex_grow_row) {
const CSSNodeRef root_child1 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child1, 1);
CSSNodeInsertChild(root, root_child1, 1);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -93,7 +93,7 @@ TEST(CSSLayoutTest, flex_basis_flex_grow_row) {
ASSERT_FLOAT_EQ(25, CSSNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child1));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -126,7 +126,7 @@ TEST(CSSLayoutTest, flex_basis_flex_shrink_column) {
const CSSNodeRef root_child1 = CSSNodeNew();
CSSNodeStyleSetFlexBasis(root_child1, 50);
CSSNodeInsertChild(root, root_child1, 1);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -143,7 +143,7 @@ TEST(CSSLayoutTest, flex_basis_flex_shrink_column) {
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetHeight(root_child1));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -165,7 +165,7 @@ TEST(CSSLayoutTest, flex_basis_flex_shrink_column) {
TEST(CSSLayoutTest, flex_basis_flex_shrink_row) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -177,7 +177,7 @@ TEST(CSSLayoutTest, flex_basis_flex_shrink_row) {
const CSSNodeRef root_child1 = CSSNodeNew();
CSSNodeStyleSetFlexBasis(root_child1, 50);
CSSNodeInsertChild(root, root_child1, 1);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -194,7 +194,7 @@ TEST(CSSLayoutTest, flex_basis_flex_shrink_row) {
ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child1));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -233,7 +233,7 @@ TEST(CSSLayoutTest, flex_shrink_to_zero) {
CSSNodeStyleSetWidth(root_child2, 50);
CSSNodeStyleSetHeight(root_child2, 50);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -255,7 +255,7 @@ TEST(CSSLayoutTest, flex_shrink_to_zero) {
ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -300,7 +300,7 @@ TEST(CSSLayoutTest, flex_basis_overrides_main_size) {
CSSNodeStyleSetFlexGrow(root_child2, 1);
CSSNodeStyleSetHeight(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -322,7 +322,7 @@ TEST(CSSLayoutTest, flex_basis_overrides_main_size) {
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -359,7 +359,7 @@ TEST(CSSLayoutTest, flex_grow_shrink_at_most) {
CSSNodeStyleSetFlexGrow(root_child0_child0, 1);
CSSNodeStyleSetFlexShrink(root_child0_child0, 1);
CSSNodeInsertChild(root_child0, root_child0_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -376,7 +376,7 @@ TEST(CSSLayoutTest, flex_grow_shrink_at_most) {
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child0_child0));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetHeight(root_child0_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));

View File

@@ -14,7 +14,7 @@
TEST(CSSLayoutTest, wrap_column) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexWrap(root, CSSWrapWrap);
CSSNodeStyleSetFlexWrap(root, YGWrapWrap);
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
@@ -36,7 +36,7 @@ TEST(CSSLayoutTest, wrap_column) {
CSSNodeStyleSetWidth(root_child3, 30);
CSSNodeStyleSetHeight(root_child3, 30);
CSSNodeInsertChild(root, root_child3, 3);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -63,7 +63,7 @@ TEST(CSSLayoutTest, wrap_column) {
ASSERT_FLOAT_EQ(30, CSSNodeLayoutGetWidth(root_child3));
ASSERT_FLOAT_EQ(30, CSSNodeLayoutGetHeight(root_child3));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -95,8 +95,8 @@ TEST(CSSLayoutTest, wrap_column) {
TEST(CSSLayoutTest, wrap_row) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetFlexWrap(root, CSSWrapWrap);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetFlexWrap(root, YGWrapWrap);
CSSNodeStyleSetWidth(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
@@ -118,7 +118,7 @@ TEST(CSSLayoutTest, wrap_row) {
CSSNodeStyleSetWidth(root_child3, 30);
CSSNodeStyleSetHeight(root_child3, 30);
CSSNodeInsertChild(root, root_child3, 3);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -145,7 +145,7 @@ TEST(CSSLayoutTest, wrap_row) {
ASSERT_FLOAT_EQ(30, CSSNodeLayoutGetWidth(root_child3));
ASSERT_FLOAT_EQ(30, CSSNodeLayoutGetHeight(root_child3));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -177,9 +177,9 @@ TEST(CSSLayoutTest, wrap_row) {
TEST(CSSLayoutTest, wrap_row_align_items_flex_end) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetAlignItems(root, CSSAlignFlexEnd);
CSSNodeStyleSetFlexWrap(root, CSSWrapWrap);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetAlignItems(root, YGAlignFlexEnd);
CSSNodeStyleSetFlexWrap(root, YGWrapWrap);
CSSNodeStyleSetWidth(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
@@ -201,7 +201,7 @@ TEST(CSSLayoutTest, wrap_row_align_items_flex_end) {
CSSNodeStyleSetWidth(root_child3, 30);
CSSNodeStyleSetHeight(root_child3, 30);
CSSNodeInsertChild(root, root_child3, 3);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -228,7 +228,7 @@ TEST(CSSLayoutTest, wrap_row_align_items_flex_end) {
ASSERT_FLOAT_EQ(30, CSSNodeLayoutGetWidth(root_child3));
ASSERT_FLOAT_EQ(30, CSSNodeLayoutGetHeight(root_child3));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -260,9 +260,9 @@ TEST(CSSLayoutTest, wrap_row_align_items_flex_end) {
TEST(CSSLayoutTest, wrap_row_align_items_center) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetAlignItems(root, CSSAlignCenter);
CSSNodeStyleSetFlexWrap(root, CSSWrapWrap);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetAlignItems(root, YGAlignCenter);
CSSNodeStyleSetFlexWrap(root, YGWrapWrap);
CSSNodeStyleSetWidth(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
@@ -284,7 +284,7 @@ TEST(CSSLayoutTest, wrap_row_align_items_center) {
CSSNodeStyleSetWidth(root_child3, 30);
CSSNodeStyleSetHeight(root_child3, 30);
CSSNodeInsertChild(root, root_child3, 3);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -311,7 +311,7 @@ TEST(CSSLayoutTest, wrap_row_align_items_center) {
ASSERT_FLOAT_EQ(30, CSSNodeLayoutGetWidth(root_child3));
ASSERT_FLOAT_EQ(30, CSSNodeLayoutGetHeight(root_child3));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));

View File

@@ -14,7 +14,7 @@
TEST(CSSLayoutTest, justify_content_row_flex_start) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetWidth(root, 102);
CSSNodeStyleSetHeight(root, 102);
@@ -29,7 +29,7 @@ TEST(CSSLayoutTest, justify_content_row_flex_start) {
const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetWidth(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -51,7 +51,7 @@ TEST(CSSLayoutTest, justify_content_row_flex_start) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(102, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -78,8 +78,8 @@ TEST(CSSLayoutTest, justify_content_row_flex_start) {
TEST(CSSLayoutTest, justify_content_row_flex_end) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetJustifyContent(root, CSSJustifyFlexEnd);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetJustifyContent(root, YGJustifyFlexEnd);
CSSNodeStyleSetWidth(root, 102);
CSSNodeStyleSetHeight(root, 102);
@@ -94,7 +94,7 @@ TEST(CSSLayoutTest, justify_content_row_flex_end) {
const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetWidth(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -116,7 +116,7 @@ TEST(CSSLayoutTest, justify_content_row_flex_end) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(102, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -143,8 +143,8 @@ TEST(CSSLayoutTest, justify_content_row_flex_end) {
TEST(CSSLayoutTest, justify_content_row_center) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetJustifyContent(root, CSSJustifyCenter);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetJustifyContent(root, YGJustifyCenter);
CSSNodeStyleSetWidth(root, 102);
CSSNodeStyleSetHeight(root, 102);
@@ -159,7 +159,7 @@ TEST(CSSLayoutTest, justify_content_row_center) {
const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetWidth(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -181,7 +181,7 @@ TEST(CSSLayoutTest, justify_content_row_center) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(102, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -208,8 +208,8 @@ TEST(CSSLayoutTest, justify_content_row_center) {
TEST(CSSLayoutTest, justify_content_row_space_between) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetJustifyContent(root, CSSJustifySpaceBetween);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetJustifyContent(root, YGJustifySpaceBetween);
CSSNodeStyleSetWidth(root, 102);
CSSNodeStyleSetHeight(root, 102);
@@ -224,7 +224,7 @@ TEST(CSSLayoutTest, justify_content_row_space_between) {
const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetWidth(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -246,7 +246,7 @@ TEST(CSSLayoutTest, justify_content_row_space_between) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(102, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -273,8 +273,8 @@ TEST(CSSLayoutTest, justify_content_row_space_between) {
TEST(CSSLayoutTest, justify_content_row_space_around) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetJustifyContent(root, CSSJustifySpaceAround);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetJustifyContent(root, YGJustifySpaceAround);
CSSNodeStyleSetWidth(root, 102);
CSSNodeStyleSetHeight(root, 102);
@@ -289,7 +289,7 @@ TEST(CSSLayoutTest, justify_content_row_space_around) {
const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetWidth(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -311,7 +311,7 @@ TEST(CSSLayoutTest, justify_content_row_space_around) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(102, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -351,7 +351,7 @@ TEST(CSSLayoutTest, justify_content_column_flex_start) {
const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetHeight(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -373,7 +373,7 @@ TEST(CSSLayoutTest, justify_content_column_flex_start) {
ASSERT_FLOAT_EQ(102, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -400,7 +400,7 @@ TEST(CSSLayoutTest, justify_content_column_flex_start) {
TEST(CSSLayoutTest, justify_content_column_flex_end) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetJustifyContent(root, CSSJustifyFlexEnd);
CSSNodeStyleSetJustifyContent(root, YGJustifyFlexEnd);
CSSNodeStyleSetWidth(root, 102);
CSSNodeStyleSetHeight(root, 102);
@@ -415,7 +415,7 @@ TEST(CSSLayoutTest, justify_content_column_flex_end) {
const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetHeight(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -437,7 +437,7 @@ TEST(CSSLayoutTest, justify_content_column_flex_end) {
ASSERT_FLOAT_EQ(102, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -464,7 +464,7 @@ TEST(CSSLayoutTest, justify_content_column_flex_end) {
TEST(CSSLayoutTest, justify_content_column_center) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetJustifyContent(root, CSSJustifyCenter);
CSSNodeStyleSetJustifyContent(root, YGJustifyCenter);
CSSNodeStyleSetWidth(root, 102);
CSSNodeStyleSetHeight(root, 102);
@@ -479,7 +479,7 @@ TEST(CSSLayoutTest, justify_content_column_center) {
const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetHeight(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -501,7 +501,7 @@ TEST(CSSLayoutTest, justify_content_column_center) {
ASSERT_FLOAT_EQ(102, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -528,7 +528,7 @@ TEST(CSSLayoutTest, justify_content_column_center) {
TEST(CSSLayoutTest, justify_content_column_space_between) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetJustifyContent(root, CSSJustifySpaceBetween);
CSSNodeStyleSetJustifyContent(root, YGJustifySpaceBetween);
CSSNodeStyleSetWidth(root, 102);
CSSNodeStyleSetHeight(root, 102);
@@ -543,7 +543,7 @@ TEST(CSSLayoutTest, justify_content_column_space_between) {
const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetHeight(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -565,7 +565,7 @@ TEST(CSSLayoutTest, justify_content_column_space_between) {
ASSERT_FLOAT_EQ(102, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -592,7 +592,7 @@ TEST(CSSLayoutTest, justify_content_column_space_between) {
TEST(CSSLayoutTest, justify_content_column_space_around) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetJustifyContent(root, CSSJustifySpaceAround);
CSSNodeStyleSetJustifyContent(root, YGJustifySpaceAround);
CSSNodeStyleSetWidth(root, 102);
CSSNodeStyleSetHeight(root, 102);
@@ -607,7 +607,7 @@ TEST(CSSLayoutTest, justify_content_column_space_around) {
const CSSNodeRef root_child2 = CSSNodeNew();
CSSNodeStyleSetHeight(root_child2, 10);
CSSNodeInsertChild(root, root_child2, 2);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -629,7 +629,7 @@ TEST(CSSLayoutTest, justify_content_column_space_around) {
ASSERT_FLOAT_EQ(102, CSSNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child2));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));

View File

@@ -14,15 +14,15 @@
TEST(CSSLayoutTest, margin_start) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetMargin(root_child0, CSSEdgeStart, 10);
CSSNodeStyleSetMargin(root_child0, YGEdgeStart, 10);
CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -34,7 +34,7 @@ TEST(CSSLayoutTest, margin_start) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -55,10 +55,10 @@ TEST(CSSLayoutTest, margin_top) {
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetMargin(root_child0, CSSEdgeTop, 10);
CSSNodeStyleSetMargin(root_child0, YGEdgeTop, 10);
CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -70,7 +70,7 @@ TEST(CSSLayoutTest, margin_top) {
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -87,16 +87,16 @@ TEST(CSSLayoutTest, margin_top) {
TEST(CSSLayoutTest, margin_end) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetJustifyContent(root, CSSJustifyFlexEnd);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetJustifyContent(root, YGJustifyFlexEnd);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetMargin(root_child0, CSSEdgeEnd, 10);
CSSNodeStyleSetMargin(root_child0, YGEdgeEnd, 10);
CSSNodeStyleSetWidth(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -108,7 +108,7 @@ TEST(CSSLayoutTest, margin_end) {
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -125,15 +125,15 @@ TEST(CSSLayoutTest, margin_end) {
TEST(CSSLayoutTest, margin_bottom) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetJustifyContent(root, CSSJustifyFlexEnd);
CSSNodeStyleSetJustifyContent(root, YGJustifyFlexEnd);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetMargin(root_child0, CSSEdgeBottom, 10);
CSSNodeStyleSetMargin(root_child0, YGEdgeBottom, 10);
CSSNodeStyleSetHeight(root_child0, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -145,7 +145,7 @@ TEST(CSSLayoutTest, margin_bottom) {
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -162,15 +162,15 @@ TEST(CSSLayoutTest, margin_bottom) {
TEST(CSSLayoutTest, margin_and_flex_row) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child0, 1);
CSSNodeStyleSetMargin(root_child0, CSSEdgeStart, 10);
CSSNodeStyleSetMargin(root_child0, YGEdgeStart, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -182,7 +182,7 @@ TEST(CSSLayoutTest, margin_and_flex_row) {
ASSERT_FLOAT_EQ(90, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -204,9 +204,9 @@ TEST(CSSLayoutTest, margin_and_flex_column) {
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child0, 1);
CSSNodeStyleSetMargin(root_child0, CSSEdgeTop, 10);
CSSNodeStyleSetMargin(root_child0, YGEdgeTop, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -218,7 +218,7 @@ TEST(CSSLayoutTest, margin_and_flex_column) {
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(90, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -235,15 +235,15 @@ TEST(CSSLayoutTest, margin_and_flex_column) {
TEST(CSSLayoutTest, margin_and_stretch_row) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child0, 1);
CSSNodeStyleSetMargin(root_child0, CSSEdgeTop, 10);
CSSNodeStyleSetMargin(root_child0, YGEdgeTop, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -255,7 +255,7 @@ TEST(CSSLayoutTest, margin_and_stretch_row) {
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(90, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -277,9 +277,9 @@ TEST(CSSLayoutTest, margin_and_stretch_column) {
const CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child0, 1);
CSSNodeStyleSetMargin(root_child0, CSSEdgeStart, 10);
CSSNodeStyleSetMargin(root_child0, YGEdgeStart, 10);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -291,7 +291,7 @@ TEST(CSSLayoutTest, margin_and_stretch_column) {
ASSERT_FLOAT_EQ(90, CSSNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child0));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -308,7 +308,7 @@ TEST(CSSLayoutTest, margin_and_stretch_column) {
TEST(CSSLayoutTest, margin_with_sibling_row) {
const CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
CSSNodeStyleSetWidth(root, 100);
CSSNodeStyleSetHeight(root, 100);
@@ -319,7 +319,7 @@ TEST(CSSLayoutTest, margin_with_sibling_row) {
const CSSNodeRef root_child1 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child1, 1);
CSSNodeInsertChild(root, root_child1, 1);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -336,7 +336,7 @@ TEST(CSSLayoutTest, margin_with_sibling_row) {
ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetHeight(root_child1));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -368,7 +368,7 @@ TEST(CSSLayoutTest, margin_with_sibling_column) {
const CSSNodeRef root_child1 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child1, 1);
CSSNodeInsertChild(root, root_child1, 1);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));
@@ -385,7 +385,7 @@ TEST(CSSLayoutTest, margin_with_sibling_column) {
ASSERT_FLOAT_EQ(100, CSSNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(50, CSSNodeLayoutGetHeight(root_child1));
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
CSSNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, CSSNodeLayoutGetTop(root));

View File

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

View File

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

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