regen unittests and small fixes after merge

This commit is contained in:
Lukas Woehrl
2016-12-21 22:22:21 +01:00
parent d517a89c1e
commit ca4481258c
3 changed files with 38 additions and 44 deletions

View File

@@ -459,15 +459,15 @@ namespace Facebook.Yoga
{
YogaNode root = new YogaNode();
root.FlexDirection = YogaFlexDirection.Row;
root.MinWidth = 100f;
root.Height = 100f;
root.MinWidth = 100.Px();
root.Height = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root_child0.FlexGrow = 1;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
root_child1.Width = 50f;
root_child1.Width = 50.Px();
root.Insert(1, root_child1);
root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout();
@@ -510,14 +510,14 @@ namespace Facebook.Yoga
public void Test_flex_grow_within_constrained_min_column()
{
YogaNode root = new YogaNode();
root.MinHeight = 100f;
root.MinHeight = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.FlexGrow = 1f;
root_child0.FlexGrow = 1;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
root_child1.Height = 50f;
root_child1.Height = 50.Px();
root.Insert(1, root_child1);
root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout();
@@ -560,21 +560,21 @@ namespace Facebook.Yoga
public void Test_flex_grow_within_constrained_max_row()
{
YogaNode root = new YogaNode();
root.Width = 200f;
root.Width = 200.Px();
YogaNode root_child0 = new YogaNode();
root_child0.FlexDirection = YogaFlexDirection.Row;
root_child0.MaxWidth = 100f;
root_child0.Height = 100f;
root_child0.MaxWidth = 100.Px();
root_child0.Height = 100.Px();
root.Insert(0, root_child0);
YogaNode root_child0_child0 = new YogaNode();
root_child0_child0.FlexShrink = 1f;
root_child0_child0.FlexBasis = 100f;
root_child0_child0.FlexShrink = 1;
root_child0_child0.FlexBasis = 100.Px();
root_child0.Insert(0, root_child0_child0);
YogaNode root_child0_child1 = new YogaNode();
root_child0_child1.Width = 50f;
root_child0_child1.Width = 50.Px();
root_child0.Insert(1, root_child0_child1);
root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout();
@@ -627,16 +627,16 @@ namespace Facebook.Yoga
public void Test_flex_grow_within_constrained_max_column()
{
YogaNode root = new YogaNode();
root.Width = 100f;
root.MaxHeight = 100f;
root.Width = 100.Px();
root.MaxHeight = 100.Px();
YogaNode root_child0 = new YogaNode();
root_child0.FlexShrink = 1f;
root_child0.FlexBasis = 100f;
root_child0.FlexShrink = 1;
root_child0.FlexBasis = 100.Px();
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
root_child1.Height = 50f;
root_child1.Height = 50.Px();
root.Insert(1, root_child1);
root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout();

View File

@@ -434,15 +434,15 @@ TEST(YogaTest, flex_grow_within_constrained_max_width) {
TEST(YogaTest, flex_grow_within_constrained_min_row) {
const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetMinWidth(root, 100);
YGNodeStyleSetHeight(root, 100);
YGNodeStyleSetMinWidth(root, YGPx(100));
YGNodeStyleSetHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetWidth(root_child1, 50);
YGNodeStyleSetWidth(root_child1, YGPx(50));
YGNodeInsertChild(root, root_child1, 1);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -483,14 +483,14 @@ TEST(YogaTest, flex_grow_within_constrained_min_row) {
TEST(YogaTest, flex_grow_within_constrained_min_column) {
const YGNodeRef root = YGNodeNew();
YGNodeStyleSetMinHeight(root, 100);
YGNodeStyleSetMinHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexGrow(root_child0, 1);
YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetHeight(root_child1, 50);
YGNodeStyleSetHeight(root_child1, YGPx(50));
YGNodeInsertChild(root, root_child1, 1);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -531,21 +531,21 @@ TEST(YogaTest, flex_grow_within_constrained_min_column) {
TEST(YogaTest, flex_grow_within_constrained_max_row) {
const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidth(root, 200);
YGNodeStyleSetWidth(root, YGPx(200));
const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow);
YGNodeStyleSetMaxWidth(root_child0, 100);
YGNodeStyleSetHeight(root_child0, 100);
YGNodeStyleSetMaxWidth(root_child0, YGPx(100));
YGNodeStyleSetHeight(root_child0, YGPx(100));
YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child0_child0 = YGNodeNew();
YGNodeStyleSetFlexShrink(root_child0_child0, 1);
YGNodeStyleSetFlexBasis(root_child0_child0, 100);
YGNodeStyleSetFlexBasis(root_child0_child0, YGPx(100));
YGNodeInsertChild(root_child0, root_child0_child0, 0);
const YGNodeRef root_child0_child1 = YGNodeNew();
YGNodeStyleSetWidth(root_child0_child1, 50);
YGNodeStyleSetWidth(root_child0_child1, YGPx(50));
YGNodeInsertChild(root_child0, root_child0_child1, 1);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
@@ -596,16 +596,16 @@ TEST(YogaTest, flex_grow_within_constrained_max_row) {
TEST(YogaTest, flex_grow_within_constrained_max_column) {
const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidth(root, 100);
YGNodeStyleSetMaxHeight(root, 100);
YGNodeStyleSetWidth(root, YGPx(100));
YGNodeStyleSetMaxHeight(root, YGPx(100));
const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetFlexShrink(root_child0, 1);
YGNodeStyleSetFlexBasis(root_child0, 100);
YGNodeStyleSetFlexBasis(root_child0, YGPx(100));
YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetHeight(root_child1, 50);
YGNodeStyleSetHeight(root_child1, YGPx(50));
YGNodeInsertChild(root, root_child1, 1);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);

View File

@@ -1597,8 +1597,6 @@ static void YGNodelayoutImpl(const YGNodeRef node,
const float marginAxisColumn = YGNodeMarginForAxis(node, YGFlexDirectionColumn, parentWidth);
// STEP 2: DETERMINE AVAILABLE SIZE IN MAIN AND CROSS DIRECTIONS
float availableInnerWidth = availableWidth - marginAxisRow - paddingAndBorderAxisRow;
float availableInnerHeight = availableHeight - marginAxisColumn - paddingAndBorderAxisColumn;
const float minInnerWidth = YGValueResolve(&node->style.minDimensions[YGDimensionWidth], parentWidth) - marginAxisRow - paddingAndBorderAxisRow;
const float maxInnerWidth = YGValueResolve(&node->style.maxDimensions[YGDimensionWidth], parentWidth) - marginAxisRow - paddingAndBorderAxisRow;
const float minInnerHeight = YGValueResolve(&node->style.minDimensions[YGDimensionHeight], parentHeight) - marginAxisColumn - paddingAndBorderAxisColumn;
@@ -1607,15 +1605,11 @@ static void YGNodelayoutImpl(const YGNodeRef node,
const float maxInnerMainDim = isMainAxisRow ? maxInnerWidth : maxInnerHeight;
// Max dimension overrides predefined dimension value; Min dimension in turn overrides both of the above
if (!YGFloatIsUndefined(availableInnerWidth)) {
availableInnerWidth = fmaxf(fminf(availableInnerWidth, maxInnerWidth), minInnerWidth);
}
if (!YGFloatIsUndefined(availableInnerHeight)) {
availableInnerHeight = fmaxf(fminf(availableInnerHeight, maxInnerHeight), minInnerHeight);
}
const float availableInnerWidth = fmaxf(fminf(availableWidth - marginAxisRow - paddingAndBorderAxisRow, maxInnerWidth), minInnerWidth);
const float availableInnerHeight = fmaxf(fminf(availableHeight - marginAxisColumn - paddingAndBorderAxisColumn, maxInnerHeight), minInnerHeight);
float availableInnerMainDim = isMainAxisRow ? availableInnerWidth : availableInnerHeight;
const float availableInnerCrossDim = isMainAxisRow ? availableInnerHeight : availableInnerWidth;
float availableInnerCrossDim = isMainAxisRow ? availableInnerHeight : availableInnerWidth;
// If there is only one child with flexGrow + flexShrink it means we can set the
// computedFlexBasis to 0 instead of measuring and shrinking / flexing the child to exactly
@@ -1772,11 +1766,11 @@ static void YGNodelayoutImpl(const YGNodeRef node,
// the line length, so there's no more space left to distribute.
// We resolve main dimension to fit minimum and maximum values
if (YGValueIsUndefined(availableInnerMainDim)) {
if (!YGValueIsUndefined(minInnerMainDim) &&
if (YGFloatIsUndefined(availableInnerMainDim)) {
if (!YGFloatIsUndefined(minInnerMainDim) &&
sizeConsumedOnCurrentLine < minInnerMainDim) {
availableInnerMainDim = minInnerMainDim;
} else if (!YGValueIsUndefined(maxInnerMainDim) &&
} else if (!YGFloatIsUndefined(maxInnerMainDim) &&
sizeConsumedOnCurrentLine > maxInnerMainDim) {
availableInnerMainDim = maxInnerMainDim;
}