Added support for min/max width and height constraints.

This commit is contained in:
Russell Keith-Magee
2015-03-31 17:27:13 +08:00
parent cf3f7ccda1
commit c523b7c404
13 changed files with 2179 additions and 73 deletions

View File

@@ -32,4 +32,10 @@ public class CSSStyle {
public float width = CSSConstants.UNDEFINED;
public float height = CSSConstants.UNDEFINED;
public float minWidth = CSSConstants.UNDEFINED;
public float minHeight = CSSConstants.UNDEFINED;
public float maxWidth = CSSConstants.UNDEFINED;
public float maxHeight = CSSConstants.UNDEFINED;
}

View File

@@ -188,6 +188,30 @@ public class LayoutEngine {
getLeading(axis)) + getPaddingAndBorder(node, getTrailing(axis));
}
private static float boundAxis(CSSNode node, CSSFlexDirection axis, float value) {
float min = CSSConstants.UNDEFINED;
float max = CSSConstants.UNDEFINED;
if (axis == CSSFlexDirection.COLUMN) {
min = node.style.minHeight;
max = node.style.maxHeight;
} else if (axis == CSSFlexDirection.ROW) {
min = node.style.minWidth;
max = node.style.maxWidth;
}
float boundValue = value;
if (!CSSConstants.isUndefined(max) && max >= 0.0 && boundValue > max) {
boundValue = max;
}
if (!CSSConstants.isUndefined(min) && min >= 0.0 && boundValue < min) {
boundValue = min;
}
return boundValue;
}
private static void setDimensionFromStyle(CSSNode node, CSSFlexDirection axis) {
// The parent already computed us a width or height. We just skip it
if (!CSSConstants.isUndefined(getLayoutDimension(node, getDim(axis)))) {
@@ -200,7 +224,7 @@ public class LayoutEngine {
// The dimensions can never be smaller than the padding and border
float maxLayoutDimension = Math.max(
getStyleDimension(node, getDim(axis)),
boundAxis(node, axis, getStyleDimension(node, getDim(axis))),
getPaddingAndBorderAxis(node, axis));
setLayoutDimension(node, getDim(axis), maxLayoutDimension);
}
@@ -283,7 +307,6 @@ public class LayoutEngine {
CSSLayoutContext layoutContext,
CSSNode node,
float parentMaxWidth) {
for (int i = 0; i < node.getChildCount(); i++) {
node.getChildAt(i).layout.resetResult();
}
@@ -360,9 +383,9 @@ public class LayoutEngine {
!CSSConstants.isUndefined(getLayoutDimension(node, getDim(crossAxis))) &&
!isDimDefined(child, crossAxis)) {
setLayoutDimension(child, getDim(crossAxis), Math.max(
getLayoutDimension(node, getDim(crossAxis)) -
boundAxis(child, crossAxis, getLayoutDimension(node, getDim(crossAxis)) -
getPaddingAndBorderAxis(node, crossAxis) -
getMarginAxis(child, crossAxis),
getMarginAxis(child, crossAxis)),
// You never want to go smaller than padding
getPaddingAndBorderAxis(child, crossAxis)
));
@@ -376,11 +399,11 @@ public class LayoutEngine {
isPosDefined(child, getLeading(axis)) &&
isPosDefined(child, getTrailing(axis))) {
setLayoutDimension(child, getDim(axis), Math.max(
getLayoutDimension(node, getDim(axis)) -
getPaddingAndBorderAxis(node, axis) -
getMarginAxis(child, axis) -
getPosition(child, getLeading(axis)) -
getPosition(child, getTrailing(axis)),
boundAxis(child, axis, getLayoutDimension(node, getDim(axis)) -
getPaddingAndBorderAxis(node, axis) -
getMarginAxis(child, axis) -
getPosition(child, getLeading(axis)) -
getPosition(child, getTrailing(axis))),
// You never want to go smaller than padding
getPaddingAndBorderAxis(child, axis)
));
@@ -430,8 +453,9 @@ public class LayoutEngine {
totalFlexible = totalFlexible + getFlex(child);
// Even if we don't know its exact size yet, we already know the padding,
// border and margin. We'll use this partial information to compute the
// remaining space.
// border and margin. We'll use this partial information, which represents
// the smallest possible size for the child, to compute the remaining
// available space.
nextContentDim = getPaddingAndBorderAxis(child, mainAxis) +
getMarginAxis(child, mainAxis);
@@ -497,6 +521,25 @@ public class LayoutEngine {
// remaining space
if (flexibleChildrenCount != 0) {
float flexibleMainDim = remainingMainDim / totalFlexible;
float baseMainDim;
float boundMainDim;
// Iterate over every child. If the flex share of remaining space doesn't
// meet min/max bounds, remove this child from flex calculations.
for (i = startLine; i < endLine; ++i) {
child = node.getChildAt(i);
if (isFlex(child)) {
baseMainDim = flexibleMainDim * getFlex(child) +
getPaddingAndBorderAxis(child, mainAxis);
boundMainDim = boundAxis(child, mainAxis, baseMainDim);
if (baseMainDim != boundMainDim) {
remainingMainDim -= boundMainDim;
totalFlexible -= getFlex(child);
}
}
}
flexibleMainDim = remainingMainDim / totalFlexible;
// The non flexible children can overflow the container, in this case
// we should just assume that there is no space available.
@@ -511,8 +554,15 @@ public class LayoutEngine {
if (isFlex(child)) {
// At this point we know the final size of the element in the main
// dimension
setLayoutDimension(child, getDim(mainAxis), flexibleMainDim * getFlex(child) +
getPaddingAndBorderAxis(child, mainAxis));
baseMainDim = flexibleMainDim * getFlex(child) +
getPaddingAndBorderAxis(child, mainAxis);
boundMainDim = boundAxis(child, mainAxis, baseMainDim);
if (baseMainDim == boundMainDim) {
setLayoutDimension(child, getDim(mainAxis), baseMainDim);
} else {
setLayoutDimension(child, getDim(mainAxis), boundMainDim);
}
maxWidth = CSSConstants.UNDEFINED;
if (isDimDefined(node, CSSFlexDirection.ROW)) {
@@ -589,7 +639,7 @@ public class LayoutEngine {
mainDim = mainDim + betweenMainDim + getDimWithMargin(child, mainAxis);
// The cross dimension is the max of the elements dimension since there
// can only be one element in that cross dimension.
crossDim = Math.max(crossDim, getDimWithMargin(child, crossAxis));
crossDim = Math.max(crossDim, boundAxis(child, crossAxis, getDimWithMargin(child, crossAxis)));
}
}
@@ -600,7 +650,7 @@ public class LayoutEngine {
containerMainAxis = Math.max(
// We're missing the last padding at this point to get the final
// dimension
mainDim + getPaddingAndBorder(node, getTrailing(mainAxis)),
boundAxis(node, mainAxis, mainDim + getPaddingAndBorder(node, getTrailing(mainAxis))),
// We can never assign a width smaller than the padding and borders
getPaddingAndBorderAxis(node, mainAxis)
);
@@ -612,7 +662,7 @@ public class LayoutEngine {
// For the cross dim, we add both sides at the end because the value
// is aggregate via a max function. Intermediate negative values
// can mess this computation otherwise
crossDim + getPaddingAndBorderAxis(node, crossAxis),
boundAxis(node, crossAxis, crossDim + getPaddingAndBorderAxis(node, crossAxis)),
getPaddingAndBorderAxis(node, crossAxis)
);
}
@@ -643,9 +693,9 @@ public class LayoutEngine {
// previously.
if (!isDimDefined(child, crossAxis)) {
setLayoutDimension(child, getDim(crossAxis), Math.max(
containerCrossAxis -
boundAxis(child, crossAxis, containerCrossAxis -
getPaddingAndBorderAxis(node, crossAxis) -
getMarginAxis(child, crossAxis),
getMarginAxis(child, crossAxis)),
// You never want to go smaller than padding
getPaddingAndBorderAxis(child, crossAxis)
));
@@ -681,7 +731,7 @@ public class LayoutEngine {
setLayoutDimension(node, getDim(mainAxis), Math.max(
// We're missing the last padding at this point to get the final
// dimension
linesMainDim + getPaddingAndBorder(node, getTrailing(mainAxis)),
boundAxis(node, mainAxis, linesMainDim + getPaddingAndBorder(node, getTrailing(mainAxis))),
// We can never assign a width smaller than the padding and borders
getPaddingAndBorderAxis(node, mainAxis)
));
@@ -692,7 +742,7 @@ public class LayoutEngine {
// For the cross dim, we add both sides at the end because the value
// is aggregate via a max function. Intermediate negative values
// can mess this computation otherwise
linesCrossDim + getPaddingAndBorderAxis(node, crossAxis),
boundAxis(node, crossAxis, linesCrossDim + getPaddingAndBorderAxis(node, crossAxis)),
getPaddingAndBorderAxis(node, crossAxis)
));
}
@@ -711,11 +761,12 @@ public class LayoutEngine {
isPosDefined(child, getLeading(axis)) &&
isPosDefined(child, getTrailing(axis))) {
setLayoutDimension(child, getDim(axis), Math.max(
getLayoutDimension(node, getDim(axis)) -
getPaddingAndBorderAxis(node, axis) -
getMarginAxis(child, axis) -
getPosition(child, getLeading(axis)) -
getPosition(child, getTrailing(axis)),
boundAxis(child, axis, getLayoutDimension(node, getDim(axis)) -
getPaddingAndBorderAxis(node, axis) -
getMarginAxis(child, axis) -
getPosition(child, getLeading(axis)) -
getPosition(child, getTrailing(axis))
),
// You never want to go smaller than padding
getPaddingAndBorderAxis(child, axis)
));

View File

@@ -4033,5 +4033,864 @@ public class LayoutEngineTest {
test("should layout flex wrap with a line bigger than container", root_node, root_layout);
}
@Test
public void testCase95()
{
TestCSSNode root_node = new TestCSSNode();
{
TestCSSNode node_0 = root_node;
node_0.style.width = 100;
node_0.style.height = 200;
node_0.style.maxWidth = 90;
node_0.style.maxHeight = 190;
}
TestCSSNode root_layout = new TestCSSNode();
{
TestCSSNode node_0 = root_layout;
node_0.layout.y = 0;
node_0.layout.x = 0;
node_0.layout.width = 90;
node_0.layout.height = 190;
}
test("should use max bounds", root_node, root_layout);
}
@Test
public void testCase96()
{
TestCSSNode root_node = new TestCSSNode();
{
TestCSSNode node_0 = root_node;
node_0.style.width = 100;
node_0.style.height = 200;
node_0.style.minWidth = 110;
node_0.style.minHeight = 210;
}
TestCSSNode root_layout = new TestCSSNode();
{
TestCSSNode node_0 = root_layout;
node_0.layout.y = 0;
node_0.layout.x = 0;
node_0.layout.width = 110;
node_0.layout.height = 210;
}
test("should use min bounds", root_node, root_layout);
}
@Test
public void testCase97()
{
TestCSSNode root_node = new TestCSSNode();
{
TestCSSNode node_0 = root_node;
node_0.style.width = 100;
node_0.style.height = 200;
node_0.style.maxWidth = 90;
node_0.style.maxHeight = 190;
node_0.style.minWidth = 110;
node_0.style.minHeight = 210;
}
TestCSSNode root_layout = new TestCSSNode();
{
TestCSSNode node_0 = root_layout;
node_0.layout.y = 0;
node_0.layout.x = 0;
node_0.layout.width = 110;
node_0.layout.height = 210;
}
test("should use min bounds over max bounds", root_node, root_layout);
}
@Test
public void testCase98()
{
TestCSSNode root_node = new TestCSSNode();
{
TestCSSNode node_0 = root_node;
node_0.style.width = 100;
node_0.style.height = 200;
node_0.style.maxWidth = 80;
node_0.style.maxHeight = 180;
node_0.style.minWidth = 90;
node_0.style.minHeight = 190;
}
TestCSSNode root_layout = new TestCSSNode();
{
TestCSSNode node_0 = root_layout;
node_0.layout.y = 0;
node_0.layout.x = 0;
node_0.layout.width = 90;
node_0.layout.height = 190;
}
test("should use min bounds over max bounds and natural width", root_node, root_layout);
}
@Test
public void testCase99()
{
TestCSSNode root_node = new TestCSSNode();
{
TestCSSNode node_0 = root_node;
node_0.style.width = 100;
node_0.style.height = 200;
node_0.style.minWidth = -10;
node_0.style.minHeight = -20;
}
TestCSSNode root_layout = new TestCSSNode();
{
TestCSSNode node_0 = root_layout;
node_0.layout.y = 0;
node_0.layout.x = 0;
node_0.layout.width = 100;
node_0.layout.height = 200;
}
test("should ignore negative min bounds", root_node, root_layout);
}
@Test
public void testCase100()
{
TestCSSNode root_node = new TestCSSNode();
{
TestCSSNode node_0 = root_node;
node_0.style.width = 100;
node_0.style.height = 200;
node_0.style.maxWidth = -10;
node_0.style.maxHeight = -20;
}
TestCSSNode root_layout = new TestCSSNode();
{
TestCSSNode node_0 = root_layout;
node_0.layout.y = 0;
node_0.layout.x = 0;
node_0.layout.width = 100;
node_0.layout.height = 200;
}
test("should ignore negative max bounds", root_node, root_layout);
}
@Test
public void testCase101()
{
TestCSSNode root_node = new TestCSSNode();
{
TestCSSNode node_0 = root_node;
node_0.style.maxWidth = 30;
node_0.style.maxHeight = 10;
node_0.style.padding[Spacing.LEFT] = 20;
node_0.style.padding[Spacing.TOP] = 15;
node_0.style.padding[Spacing.RIGHT] = 20;
node_0.style.padding[Spacing.BOTTOM] = 15;
}
TestCSSNode root_layout = new TestCSSNode();
{
TestCSSNode node_0 = root_layout;
node_0.layout.y = 0;
node_0.layout.x = 0;
node_0.layout.width = 40;
node_0.layout.height = 30;
}
test("should use padded size over max bounds", root_node, root_layout);
}
@Test
public void testCase102()
{
TestCSSNode root_node = new TestCSSNode();
{
TestCSSNode node_0 = root_node;
node_0.style.minWidth = 50;
node_0.style.minHeight = 40;
node_0.style.padding[Spacing.LEFT] = 20;
node_0.style.padding[Spacing.TOP] = 15;
node_0.style.padding[Spacing.RIGHT] = 20;
node_0.style.padding[Spacing.BOTTOM] = 15;
}
TestCSSNode root_layout = new TestCSSNode();
{
TestCSSNode node_0 = root_layout;
node_0.layout.y = 0;
node_0.layout.x = 0;
node_0.layout.width = 50;
node_0.layout.height = 40;
}
test("should use min size over padded size", root_node, root_layout);
}
@Test
public void testCase103()
{
TestCSSNode root_node = new TestCSSNode();
{
TestCSSNode node_0 = root_node;
node_0.style.flexDirection = CSSFlexDirection.ROW;
node_0.style.width = 300;
node_0.style.height = 200;
addChildren(node_0, 3);
{
TestCSSNode node_1;
node_1 = node_0.getChildAt(0);
node_1.style.flex = 1;
node_1 = node_0.getChildAt(1);
node_1.style.flex = 1;
node_1.style.minWidth = 200;
node_1 = node_0.getChildAt(2);
node_1.style.flex = 1;
}
}
TestCSSNode root_layout = new TestCSSNode();
{
TestCSSNode node_0 = root_layout;
node_0.layout.y = 0;
node_0.layout.x = 0;
node_0.layout.width = 300;
node_0.layout.height = 200;
addChildren(node_0, 3);
{
TestCSSNode node_1;
node_1 = node_0.getChildAt(0);
node_1.layout.y = 0;
node_1.layout.x = 0;
node_1.layout.width = 50;
node_1.layout.height = 200;
node_1 = node_0.getChildAt(1);
node_1.layout.y = 0;
node_1.layout.x = 50;
node_1.layout.width = 200;
node_1.layout.height = 200;
node_1 = node_0.getChildAt(2);
node_1.layout.y = 0;
node_1.layout.x = 250;
node_1.layout.width = 50;
node_1.layout.height = 200;
}
}
test("should override flex direction size with min bounds", root_node, root_layout);
}
@Test
public void testCase104()
{
TestCSSNode root_node = new TestCSSNode();
{
TestCSSNode node_0 = root_node;
node_0.style.flexDirection = CSSFlexDirection.ROW;
node_0.style.width = 300;
node_0.style.height = 200;
addChildren(node_0, 3);
{
TestCSSNode node_1;
node_1 = node_0.getChildAt(0);
node_1.style.flex = 1;
node_1 = node_0.getChildAt(1);
node_1.style.flex = 1;
node_1.style.maxWidth = 110;
node_1.style.minWidth = 90;
node_1 = node_0.getChildAt(2);
node_1.style.flex = 1;
}
}
TestCSSNode root_layout = new TestCSSNode();
{
TestCSSNode node_0 = root_layout;
node_0.layout.y = 0;
node_0.layout.x = 0;
node_0.layout.width = 300;
node_0.layout.height = 200;
addChildren(node_0, 3);
{
TestCSSNode node_1;
node_1 = node_0.getChildAt(0);
node_1.layout.y = 0;
node_1.layout.x = 0;
node_1.layout.width = 100;
node_1.layout.height = 200;
node_1 = node_0.getChildAt(1);
node_1.layout.y = 0;
node_1.layout.x = 100;
node_1.layout.width = 100;
node_1.layout.height = 200;
node_1 = node_0.getChildAt(2);
node_1.layout.y = 0;
node_1.layout.x = 200;
node_1.layout.width = 100;
node_1.layout.height = 200;
}
}
test("should not override flex direction size within bounds", root_node, root_layout);
}
@Test
public void testCase105()
{
TestCSSNode root_node = new TestCSSNode();
{
TestCSSNode node_0 = root_node;
node_0.style.flexDirection = CSSFlexDirection.ROW;
node_0.style.width = 300;
node_0.style.height = 200;
addChildren(node_0, 3);
{
TestCSSNode node_1;
node_1 = node_0.getChildAt(0);
node_1.style.flex = 1;
node_1 = node_0.getChildAt(1);
node_1.style.flex = 1;
node_1.style.maxWidth = 60;
node_1 = node_0.getChildAt(2);
node_1.style.flex = 1;
}
}
TestCSSNode root_layout = new TestCSSNode();
{
TestCSSNode node_0 = root_layout;
node_0.layout.y = 0;
node_0.layout.x = 0;
node_0.layout.width = 300;
node_0.layout.height = 200;
addChildren(node_0, 3);
{
TestCSSNode node_1;
node_1 = node_0.getChildAt(0);
node_1.layout.y = 0;
node_1.layout.x = 0;
node_1.layout.width = 120;
node_1.layout.height = 200;
node_1 = node_0.getChildAt(1);
node_1.layout.y = 0;
node_1.layout.x = 120;
node_1.layout.width = 60;
node_1.layout.height = 200;
node_1 = node_0.getChildAt(2);
node_1.layout.y = 0;
node_1.layout.x = 180;
node_1.layout.width = 120;
node_1.layout.height = 200;
}
}
test("should override flex direction size with max bounds", root_node, root_layout);
}
@Test
public void testCase106()
{
TestCSSNode root_node = new TestCSSNode();
{
TestCSSNode node_0 = root_node;
node_0.style.width = 300;
node_0.style.height = 200;
addChildren(node_0, 1);
{
TestCSSNode node_1;
node_1 = node_0.getChildAt(0);
node_1.style.flex = 1;
node_1.style.maxWidth = 310;
node_1.style.minWidth = 290;
}
}
TestCSSNode root_layout = new TestCSSNode();
{
TestCSSNode node_0 = root_layout;
node_0.layout.y = 0;
node_0.layout.x = 0;
node_0.layout.width = 300;
node_0.layout.height = 200;
addChildren(node_0, 1);
{
TestCSSNode node_1;
node_1 = node_0.getChildAt(0);
node_1.layout.y = 0;
node_1.layout.x = 0;
node_1.layout.width = 300;
node_1.layout.height = 200;
}
}
test("should pre-fill child size within bounds", root_node, root_layout);
}
@Test
public void testCase107()
{
TestCSSNode root_node = new TestCSSNode();
{
TestCSSNode node_0 = root_node;
node_0.style.width = 300;
node_0.style.height = 200;
addChildren(node_0, 1);
{
TestCSSNode node_1;
node_1 = node_0.getChildAt(0);
node_1.style.flex = 1;
node_1.style.maxWidth = 290;
}
}
TestCSSNode root_layout = new TestCSSNode();
{
TestCSSNode node_0 = root_layout;
node_0.layout.y = 0;
node_0.layout.x = 0;
node_0.layout.width = 300;
node_0.layout.height = 200;
addChildren(node_0, 1);
{
TestCSSNode node_1;
node_1 = node_0.getChildAt(0);
node_1.layout.y = 0;
node_1.layout.x = 0;
node_1.layout.width = 290;
node_1.layout.height = 200;
}
}
test("should pre-fill child size within max bound", root_node, root_layout);
}
@Test
public void testCase108()
{
TestCSSNode root_node = new TestCSSNode();
{
TestCSSNode node_0 = root_node;
node_0.style.width = 300;
node_0.style.height = 200;
addChildren(node_0, 1);
{
TestCSSNode node_1;
node_1 = node_0.getChildAt(0);
node_1.style.flex = 1;
node_1.style.minWidth = 310;
}
}
TestCSSNode root_layout = new TestCSSNode();
{
TestCSSNode node_0 = root_layout;
node_0.layout.y = 0;
node_0.layout.x = 0;
node_0.layout.width = 300;
node_0.layout.height = 200;
addChildren(node_0, 1);
{
TestCSSNode node_1;
node_1 = node_0.getChildAt(0);
node_1.layout.y = 0;
node_1.layout.x = 0;
node_1.layout.width = 310;
node_1.layout.height = 200;
}
}
test("should pre-fill child size within min bounds", root_node, root_layout);
}
@Test
public void testCase109()
{
TestCSSNode root_node = new TestCSSNode();
{
TestCSSNode node_0 = root_node;
node_0.style.maxWidth = 300;
node_0.style.maxHeight = 700;
node_0.style.minWidth = 100;
node_0.style.minHeight = 500;
addChildren(node_0, 2);
{
TestCSSNode node_1;
node_1 = node_0.getChildAt(0);
node_1.style.width = 200;
node_1.style.height = 300;
node_1 = node_0.getChildAt(1);
node_1.style.width = 200;
node_1.style.height = 300;
}
}
TestCSSNode root_layout = new TestCSSNode();
{
TestCSSNode node_0 = root_layout;
node_0.layout.y = 0;
node_0.layout.x = 0;
node_0.layout.width = 200;
node_0.layout.height = 600;
addChildren(node_0, 2);
{
TestCSSNode node_1;
node_1 = node_0.getChildAt(0);
node_1.layout.y = 0;
node_1.layout.x = 0;
node_1.layout.width = 200;
node_1.layout.height = 300;
node_1 = node_0.getChildAt(1);
node_1.layout.y = 300;
node_1.layout.x = 0;
node_1.layout.width = 200;
node_1.layout.height = 300;
}
}
test("should set parents size based on bounded children", root_node, root_layout);
}
@Test
public void testCase110()
{
TestCSSNode root_node = new TestCSSNode();
{
TestCSSNode node_0 = root_node;
node_0.style.maxWidth = 100;
node_0.style.maxHeight = 500;
addChildren(node_0, 2);
{
TestCSSNode node_1;
node_1 = node_0.getChildAt(0);
node_1.style.width = 200;
node_1.style.height = 300;
node_1 = node_0.getChildAt(1);
node_1.style.width = 200;
node_1.style.height = 300;
}
}
TestCSSNode root_layout = new TestCSSNode();
{
TestCSSNode node_0 = root_layout;
node_0.layout.y = 0;
node_0.layout.x = 0;
node_0.layout.width = 100;
node_0.layout.height = 500;
addChildren(node_0, 2);
{
TestCSSNode node_1;
node_1 = node_0.getChildAt(0);
node_1.layout.y = 0;
node_1.layout.x = 0;
node_1.layout.width = 200;
node_1.layout.height = 300;
node_1 = node_0.getChildAt(1);
node_1.layout.y = 300;
node_1.layout.x = 0;
node_1.layout.width = 200;
node_1.layout.height = 300;
}
}
test("should set parents size based on max bounded children", root_node, root_layout);
}
@Test
public void testCase111()
{
TestCSSNode root_node = new TestCSSNode();
{
TestCSSNode node_0 = root_node;
node_0.style.minWidth = 300;
node_0.style.minHeight = 700;
addChildren(node_0, 2);
{
TestCSSNode node_1;
node_1 = node_0.getChildAt(0);
node_1.style.width = 200;
node_1.style.height = 300;
node_1 = node_0.getChildAt(1);
node_1.style.width = 200;
node_1.style.height = 300;
}
}
TestCSSNode root_layout = new TestCSSNode();
{
TestCSSNode node_0 = root_layout;
node_0.layout.y = 0;
node_0.layout.x = 0;
node_0.layout.width = 300;
node_0.layout.height = 700;
addChildren(node_0, 2);
{
TestCSSNode node_1;
node_1 = node_0.getChildAt(0);
node_1.layout.y = 0;
node_1.layout.x = 0;
node_1.layout.width = 200;
node_1.layout.height = 300;
node_1 = node_0.getChildAt(1);
node_1.layout.y = 300;
node_1.layout.x = 0;
node_1.layout.width = 200;
node_1.layout.height = 300;
}
}
test("should set parents size based on min bounded children", root_node, root_layout);
}
@Test
public void testCase112()
{
TestCSSNode root_node = new TestCSSNode();
{
TestCSSNode node_0 = root_node;
node_0.style.alignItems = CSSAlign.STRETCH;
node_0.style.width = 1000;
addChildren(node_0, 1);
{
TestCSSNode node_1;
node_1 = node_0.getChildAt(0);
node_1.style.height = 100;
node_1.style.maxWidth = 1100;
node_1.style.maxHeight = 110;
node_1.style.minWidth = 900;
node_1.style.minHeight = 90;
}
}
TestCSSNode root_layout = new TestCSSNode();
{
TestCSSNode node_0 = root_layout;
node_0.layout.y = 0;
node_0.layout.x = 0;
node_0.layout.width = 1000;
node_0.layout.height = 100;
addChildren(node_0, 1);
{
TestCSSNode node_1;
node_1 = node_0.getChildAt(0);
node_1.layout.y = 0;
node_1.layout.x = 0;
node_1.layout.width = 1000;
node_1.layout.height = 100;
}
}
test("should keep stretched size within bounds", root_node, root_layout);
}
@Test
public void testCase113()
{
TestCSSNode root_node = new TestCSSNode();
{
TestCSSNode node_0 = root_node;
node_0.style.alignItems = CSSAlign.STRETCH;
node_0.style.width = 1000;
addChildren(node_0, 1);
{
TestCSSNode node_1;
node_1 = node_0.getChildAt(0);
node_1.style.height = 100;
node_1.style.maxWidth = 900;
node_1.style.maxHeight = 90;
}
}
TestCSSNode root_layout = new TestCSSNode();
{
TestCSSNode node_0 = root_layout;
node_0.layout.y = 0;
node_0.layout.x = 0;
node_0.layout.width = 1000;
node_0.layout.height = 90;
addChildren(node_0, 1);
{
TestCSSNode node_1;
node_1 = node_0.getChildAt(0);
node_1.layout.y = 0;
node_1.layout.x = 0;
node_1.layout.width = 900;
node_1.layout.height = 90;
}
}
test("should keep stretched size within max bounds", root_node, root_layout);
}
@Test
public void testCase114()
{
TestCSSNode root_node = new TestCSSNode();
{
TestCSSNode node_0 = root_node;
node_0.style.alignItems = CSSAlign.STRETCH;
node_0.style.width = 1000;
addChildren(node_0, 1);
{
TestCSSNode node_1;
node_1 = node_0.getChildAt(0);
node_1.style.height = 100;
node_1.style.minWidth = 1100;
node_1.style.minHeight = 110;
}
}
TestCSSNode root_layout = new TestCSSNode();
{
TestCSSNode node_0 = root_layout;
node_0.layout.y = 0;
node_0.layout.x = 0;
node_0.layout.width = 1000;
node_0.layout.height = 110;
addChildren(node_0, 1);
{
TestCSSNode node_1;
node_1 = node_0.getChildAt(0);
node_1.layout.y = 0;
node_1.layout.x = 0;
node_1.layout.width = 1100;
node_1.layout.height = 110;
}
}
test("should keep stretched size within min bounds", root_node, root_layout);
}
@Test
public void testCase115()
{
TestCSSNode root_node = new TestCSSNode();
{
TestCSSNode node_0 = root_node;
node_0.style.flexDirection = CSSFlexDirection.ROW;
node_0.style.width = 1000;
addChildren(node_0, 1);
{
TestCSSNode node_1;
node_1 = node_0.getChildAt(0);
node_1.style.height = 100;
node_1.style.minWidth = 100;
node_1.style.minHeight = 110;
}
}
TestCSSNode root_layout = new TestCSSNode();
{
TestCSSNode node_0 = root_layout;
node_0.layout.y = 0;
node_0.layout.x = 0;
node_0.layout.width = 1000;
node_0.layout.height = 110;
addChildren(node_0, 1);
{
TestCSSNode node_1;
node_1 = node_0.getChildAt(0);
node_1.layout.y = 0;
node_1.layout.x = 0;
node_1.layout.width = 100;
node_1.layout.height = 110;
}
}
test("should keep cross axis size within min bounds", root_node, root_layout);
}
@Test
public void testCase116()
{
TestCSSNode root_node = new TestCSSNode();
{
TestCSSNode node_0 = root_node;
node_0.style.width = 1000;
node_0.style.height = 1000;
addChildren(node_0, 1);
{
TestCSSNode node_1;
node_1 = node_0.getChildAt(0);
node_1.style.positionType = CSSPositionType.ABSOLUTE;
node_1.style.maxWidth = 500;
node_1.style.maxHeight = 600;
node_1.style.positionLeft = 100;
node_1.style.positionTop = 100;
node_1.style.positionRight = 100;
node_1.style.positionBottom = 100;
}
}
TestCSSNode root_layout = new TestCSSNode();
{
TestCSSNode node_0 = root_layout;
node_0.layout.y = 0;
node_0.layout.x = 0;
node_0.layout.width = 1000;
node_0.layout.height = 1000;
addChildren(node_0, 1);
{
TestCSSNode node_1;
node_1 = node_0.getChildAt(0);
node_1.layout.y = 100;
node_1.layout.x = 100;
node_1.layout.width = 500;
node_1.layout.height = 600;
}
}
test("should layout node with position absolute, top and left and max bounds", root_node, root_layout);
}
@Test
public void testCase117()
{
TestCSSNode root_node = new TestCSSNode();
{
TestCSSNode node_0 = root_node;
node_0.style.width = 1000;
node_0.style.height = 1000;
addChildren(node_0, 1);
{
TestCSSNode node_1;
node_1 = node_0.getChildAt(0);
node_1.style.positionType = CSSPositionType.ABSOLUTE;
node_1.style.minWidth = 900;
node_1.style.minHeight = 1000;
node_1.style.positionLeft = 100;
node_1.style.positionTop = 100;
node_1.style.positionRight = 100;
node_1.style.positionBottom = 100;
}
}
TestCSSNode root_layout = new TestCSSNode();
{
TestCSSNode node_0 = root_layout;
node_0.layout.y = 0;
node_0.layout.x = 0;
node_0.layout.width = 1000;
node_0.layout.height = 1000;
addChildren(node_0, 1);
{
TestCSSNode node_1;
node_1 = node_0.getChildAt(0);
node_1.layout.y = 100;
node_1.layout.x = 100;
node_1.layout.width = 900;
node_1.layout.height = 1000;
}
}
test("should layout node with position absolute, top and left and min bounds", root_node, root_layout);
}
/** END_GENERATED **/
}