Fix align-content of cross-stretched container (#1524)
Summary: X-link: https://github.com/facebook/react-native/pull/41964 Pull Request resolved: https://github.com/facebook/yoga/pull/1524 D52087013 (#1513) fixed some issues, including where measuring under max-content or fit-content, align-content stretch would consume the entire available cross-dimensions, instead of only sizing to definite dimension, like the spec dicates. I missed a case, where flexbox considers a container as having a definite cross-size if it is being stretched, even if it doesn't have a definite length. https://www.w3.org/TR/css-flexbox-1/#definite-sizes > 3. Once the cross size of a flex line has been determined, items in auto-sized flex containers are also considered definite for the purpose of layout; > 1. If a single-line flex container has a definite cross size, the outer cross size of any stretched flex items is the flex container’s inner cross size (clamped to the flex item’s min and max cross size) and is considered definite. We handle `align-items: stretch` of a flex container after cross-size determination by laying out the child under stretch-fit (previously YGMeasureModeExactly) constraint. This checks that case, and sizing the line container to specified cross-dim if we are told to stretch to it. We could probably afford to merge this a bit with later with what is currently step 9, where we end up redoing some of this same math. Reviewed By: yungsters Differential Revision: D52234980 fbshipit-source-id: 475773a352fd01f63a4b21e93a55519726dc0da7
This commit is contained in:
committed by
Facebook GitHub Bot
parent
2a8c7a4223
commit
a1751127ef
@@ -396,3 +396,39 @@
|
|||||||
<div style="height: 100px; width: 120px;"></div>
|
<div style="height: 100px; width: 120px;"></div>
|
||||||
<div style="height: 50px; width: 120px;"></div>
|
<div style="height: 50px; width: 120px;"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="align_content_flex_start_stretch_doesnt_influence_line_box_dim" style="width: 400px; flex-direction: row; padding-top: 20px; padding-bottom: 20px; padding-left: 20px; padding-right: 20px;">
|
||||||
|
<div style="height: 100px; width: 100px; margin-right: 20px;"></div>
|
||||||
|
<div style="flex-direction: row; flex-wrap: wrap; flex-shrink: 1; flex-grow: 1; align-content: flex-start;">
|
||||||
|
<div style="height: 30px; width: 30px; margin-right: 20px;"></div>
|
||||||
|
<div style="height: 30px; width: 30px; margin-right: 20px;"></div>
|
||||||
|
<div style="height: 30px; width: 30px; margin-right: 20px;"></div>
|
||||||
|
<div style="height: 30px; width: 30px; margin-right: 20px;"></div>
|
||||||
|
<div style="height: 30px; width: 30px; margin-right: 20px;"></div>
|
||||||
|
</div>
|
||||||
|
<div style="height: 50px; width: 50px; margin-left: 20px;"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="align_content_stretch_stretch_does_influence_line_box_dim" style="width: 400px; flex-direction: row; padding-top: 20px; padding-bottom: 20px; padding-left: 20px; padding-right: 20px;">
|
||||||
|
<div style="height: 100px; width: 100px; margin-right: 20px;"></div>
|
||||||
|
<div style="flex-direction: row; flex-wrap: wrap; flex-shrink: 1; flex-grow: 1; align-content: stretch;">
|
||||||
|
<div style="height: 30px; width: 30px; margin-right: 20px;"></div>
|
||||||
|
<div style="height: 30px; width: 30px; margin-right: 20px;"></div>
|
||||||
|
<div style="height: 30px; width: 30px; margin-right: 20px;"></div>
|
||||||
|
<div style="height: 30px; width: 30px; margin-right: 20px;"></div>
|
||||||
|
<div style="height: 30px; width: 30px; margin-right: 20px;"></div>
|
||||||
|
</div>
|
||||||
|
<div style="height: 50px; width: 50px; margin-left: 20px;"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="align_content_space_evenly_stretch_does_influence_line_box_dim" style="width: 400px; flex-direction: row; padding-top: 20px; padding-bottom: 20px; padding-left: 20px; padding-right: 20px;">
|
||||||
|
<div style="height: 100px; width: 100px; margin-right: 20px;"></div>
|
||||||
|
<div style="flex-direction: row; flex-wrap: wrap; flex-shrink: 1; flex-grow: 1; align-content: stretch;">
|
||||||
|
<div style="height: 30px; width: 30px; margin-right: 20px;"></div>
|
||||||
|
<div style="height: 30px; width: 30px; margin-right: 20px;"></div>
|
||||||
|
<div style="height: 30px; width: 30px; margin-right: 20px;"></div>
|
||||||
|
<div style="height: 30px; width: 30px; margin-right: 20px;"></div>
|
||||||
|
<div style="height: 30px; width: 30px; margin-right: 20px;"></div>
|
||||||
|
</div>
|
||||||
|
<div style="height: 50px; width: 50px; margin-left: 20px;"></div>
|
||||||
|
</div>
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*
|
*
|
||||||
* @generated SignedSource<<d7a3a106458c874d95ce8b61bd4f07bf>>
|
* @generated SignedSource<<75aa9390813e51550d9760c37e59de0c>>
|
||||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAlignContentTest.html
|
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAlignContentTest.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -4601,6 +4601,485 @@ public class YGAlignContentTest {
|
|||||||
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_align_content_flex_start_stretch_doesnt_influence_line_box_dim() {
|
||||||
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
|
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||||
|
|
||||||
|
final YogaNode root = createNode(config);
|
||||||
|
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||||
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||||
|
root.setPadding(YogaEdge.LEFT, 20);
|
||||||
|
root.setPadding(YogaEdge.TOP, 20);
|
||||||
|
root.setPadding(YogaEdge.RIGHT, 20);
|
||||||
|
root.setPadding(YogaEdge.BOTTOM, 20);
|
||||||
|
root.setWidth(400f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = createNode(config);
|
||||||
|
root_child0.setMargin(YogaEdge.RIGHT, 20f);
|
||||||
|
root_child0.setWidth(100f);
|
||||||
|
root_child0.setHeight(100f);
|
||||||
|
root.addChildAt(root_child0, 0);
|
||||||
|
|
||||||
|
final YogaNode root_child1 = createNode(config);
|
||||||
|
root_child1.setFlexDirection(YogaFlexDirection.ROW);
|
||||||
|
root_child1.setWrap(YogaWrap.WRAP);
|
||||||
|
root_child1.setFlexGrow(1f);
|
||||||
|
root_child1.setFlexShrink(1f);
|
||||||
|
root.addChildAt(root_child1, 1);
|
||||||
|
|
||||||
|
final YogaNode root_child1_child0 = createNode(config);
|
||||||
|
root_child1_child0.setMargin(YogaEdge.RIGHT, 20f);
|
||||||
|
root_child1_child0.setWidth(30f);
|
||||||
|
root_child1_child0.setHeight(30f);
|
||||||
|
root_child1.addChildAt(root_child1_child0, 0);
|
||||||
|
|
||||||
|
final YogaNode root_child1_child1 = createNode(config);
|
||||||
|
root_child1_child1.setMargin(YogaEdge.RIGHT, 20f);
|
||||||
|
root_child1_child1.setWidth(30f);
|
||||||
|
root_child1_child1.setHeight(30f);
|
||||||
|
root_child1.addChildAt(root_child1_child1, 1);
|
||||||
|
|
||||||
|
final YogaNode root_child1_child2 = createNode(config);
|
||||||
|
root_child1_child2.setMargin(YogaEdge.RIGHT, 20f);
|
||||||
|
root_child1_child2.setWidth(30f);
|
||||||
|
root_child1_child2.setHeight(30f);
|
||||||
|
root_child1.addChildAt(root_child1_child2, 2);
|
||||||
|
|
||||||
|
final YogaNode root_child1_child3 = createNode(config);
|
||||||
|
root_child1_child3.setMargin(YogaEdge.RIGHT, 20f);
|
||||||
|
root_child1_child3.setWidth(30f);
|
||||||
|
root_child1_child3.setHeight(30f);
|
||||||
|
root_child1.addChildAt(root_child1_child3, 3);
|
||||||
|
|
||||||
|
final YogaNode root_child1_child4 = createNode(config);
|
||||||
|
root_child1_child4.setMargin(YogaEdge.RIGHT, 20f);
|
||||||
|
root_child1_child4.setWidth(30f);
|
||||||
|
root_child1_child4.setHeight(30f);
|
||||||
|
root_child1.addChildAt(root_child1_child4, 4);
|
||||||
|
|
||||||
|
final YogaNode root_child2 = createNode(config);
|
||||||
|
root_child2.setMargin(YogaEdge.LEFT, 20f);
|
||||||
|
root_child2.setWidth(50f);
|
||||||
|
root_child2.setHeight(50f);
|
||||||
|
root.addChildAt(root_child2, 2);
|
||||||
|
root.setDirection(YogaDirection.LTR);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(400f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(140f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(20f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(20f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(140f, root_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(20f, root_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(170f, root_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(50f, root_child1_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(100f, root_child1_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child1_child3.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child3.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child3.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child3.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(50f, root_child1_child4.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child4.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child4.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child4.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(330f, root_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(20f, root_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
root.setDirection(YogaDirection.RTL);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(400f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(140f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(260f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(20f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(90f, root_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(20f, root_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(170f, root_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(120f, root_child1_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(70f, root_child1_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(20f, root_child1_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(120f, root_child1_child3.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child3.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child3.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child3.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(70f, root_child1_child4.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child4.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child4.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child4.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(40f, root_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(20f, root_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_align_content_stretch_stretch_does_influence_line_box_dim() {
|
||||||
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
|
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||||
|
|
||||||
|
final YogaNode root = createNode(config);
|
||||||
|
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||||
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||||
|
root.setPadding(YogaEdge.LEFT, 20);
|
||||||
|
root.setPadding(YogaEdge.TOP, 20);
|
||||||
|
root.setPadding(YogaEdge.RIGHT, 20);
|
||||||
|
root.setPadding(YogaEdge.BOTTOM, 20);
|
||||||
|
root.setWidth(400f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = createNode(config);
|
||||||
|
root_child0.setMargin(YogaEdge.RIGHT, 20f);
|
||||||
|
root_child0.setWidth(100f);
|
||||||
|
root_child0.setHeight(100f);
|
||||||
|
root.addChildAt(root_child0, 0);
|
||||||
|
|
||||||
|
final YogaNode root_child1 = createNode(config);
|
||||||
|
root_child1.setFlexDirection(YogaFlexDirection.ROW);
|
||||||
|
root_child1.setAlignContent(YogaAlign.STRETCH);
|
||||||
|
root_child1.setWrap(YogaWrap.WRAP);
|
||||||
|
root_child1.setFlexGrow(1f);
|
||||||
|
root_child1.setFlexShrink(1f);
|
||||||
|
root.addChildAt(root_child1, 1);
|
||||||
|
|
||||||
|
final YogaNode root_child1_child0 = createNode(config);
|
||||||
|
root_child1_child0.setMargin(YogaEdge.RIGHT, 20f);
|
||||||
|
root_child1_child0.setWidth(30f);
|
||||||
|
root_child1_child0.setHeight(30f);
|
||||||
|
root_child1.addChildAt(root_child1_child0, 0);
|
||||||
|
|
||||||
|
final YogaNode root_child1_child1 = createNode(config);
|
||||||
|
root_child1_child1.setMargin(YogaEdge.RIGHT, 20f);
|
||||||
|
root_child1_child1.setWidth(30f);
|
||||||
|
root_child1_child1.setHeight(30f);
|
||||||
|
root_child1.addChildAt(root_child1_child1, 1);
|
||||||
|
|
||||||
|
final YogaNode root_child1_child2 = createNode(config);
|
||||||
|
root_child1_child2.setMargin(YogaEdge.RIGHT, 20f);
|
||||||
|
root_child1_child2.setWidth(30f);
|
||||||
|
root_child1_child2.setHeight(30f);
|
||||||
|
root_child1.addChildAt(root_child1_child2, 2);
|
||||||
|
|
||||||
|
final YogaNode root_child1_child3 = createNode(config);
|
||||||
|
root_child1_child3.setMargin(YogaEdge.RIGHT, 20f);
|
||||||
|
root_child1_child3.setWidth(30f);
|
||||||
|
root_child1_child3.setHeight(30f);
|
||||||
|
root_child1.addChildAt(root_child1_child3, 3);
|
||||||
|
|
||||||
|
final YogaNode root_child1_child4 = createNode(config);
|
||||||
|
root_child1_child4.setMargin(YogaEdge.RIGHT, 20f);
|
||||||
|
root_child1_child4.setWidth(30f);
|
||||||
|
root_child1_child4.setHeight(30f);
|
||||||
|
root_child1.addChildAt(root_child1_child4, 4);
|
||||||
|
|
||||||
|
final YogaNode root_child2 = createNode(config);
|
||||||
|
root_child2.setMargin(YogaEdge.LEFT, 20f);
|
||||||
|
root_child2.setWidth(50f);
|
||||||
|
root_child2.setHeight(50f);
|
||||||
|
root.addChildAt(root_child2, 2);
|
||||||
|
root.setDirection(YogaDirection.LTR);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(400f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(140f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(20f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(20f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(140f, root_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(20f, root_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(170f, root_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(50f, root_child1_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(100f, root_child1_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child1_child3.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(50f, root_child1_child3.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child3.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child3.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(50f, root_child1_child4.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(50f, root_child1_child4.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child4.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child4.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(330f, root_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(20f, root_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
root.setDirection(YogaDirection.RTL);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(400f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(140f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(260f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(20f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(90f, root_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(20f, root_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(170f, root_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(120f, root_child1_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(70f, root_child1_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(20f, root_child1_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(120f, root_child1_child3.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(50f, root_child1_child3.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child3.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child3.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(70f, root_child1_child4.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(50f, root_child1_child4.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child4.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child4.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(40f, root_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(20f, root_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_align_content_space_evenly_stretch_does_influence_line_box_dim() {
|
||||||
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
|
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||||
|
|
||||||
|
final YogaNode root = createNode(config);
|
||||||
|
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||||
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||||
|
root.setPadding(YogaEdge.LEFT, 20);
|
||||||
|
root.setPadding(YogaEdge.TOP, 20);
|
||||||
|
root.setPadding(YogaEdge.RIGHT, 20);
|
||||||
|
root.setPadding(YogaEdge.BOTTOM, 20);
|
||||||
|
root.setWidth(400f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = createNode(config);
|
||||||
|
root_child0.setMargin(YogaEdge.RIGHT, 20f);
|
||||||
|
root_child0.setWidth(100f);
|
||||||
|
root_child0.setHeight(100f);
|
||||||
|
root.addChildAt(root_child0, 0);
|
||||||
|
|
||||||
|
final YogaNode root_child1 = createNode(config);
|
||||||
|
root_child1.setFlexDirection(YogaFlexDirection.ROW);
|
||||||
|
root_child1.setAlignContent(YogaAlign.STRETCH);
|
||||||
|
root_child1.setWrap(YogaWrap.WRAP);
|
||||||
|
root_child1.setFlexGrow(1f);
|
||||||
|
root_child1.setFlexShrink(1f);
|
||||||
|
root.addChildAt(root_child1, 1);
|
||||||
|
|
||||||
|
final YogaNode root_child1_child0 = createNode(config);
|
||||||
|
root_child1_child0.setMargin(YogaEdge.RIGHT, 20f);
|
||||||
|
root_child1_child0.setWidth(30f);
|
||||||
|
root_child1_child0.setHeight(30f);
|
||||||
|
root_child1.addChildAt(root_child1_child0, 0);
|
||||||
|
|
||||||
|
final YogaNode root_child1_child1 = createNode(config);
|
||||||
|
root_child1_child1.setMargin(YogaEdge.RIGHT, 20f);
|
||||||
|
root_child1_child1.setWidth(30f);
|
||||||
|
root_child1_child1.setHeight(30f);
|
||||||
|
root_child1.addChildAt(root_child1_child1, 1);
|
||||||
|
|
||||||
|
final YogaNode root_child1_child2 = createNode(config);
|
||||||
|
root_child1_child2.setMargin(YogaEdge.RIGHT, 20f);
|
||||||
|
root_child1_child2.setWidth(30f);
|
||||||
|
root_child1_child2.setHeight(30f);
|
||||||
|
root_child1.addChildAt(root_child1_child2, 2);
|
||||||
|
|
||||||
|
final YogaNode root_child1_child3 = createNode(config);
|
||||||
|
root_child1_child3.setMargin(YogaEdge.RIGHT, 20f);
|
||||||
|
root_child1_child3.setWidth(30f);
|
||||||
|
root_child1_child3.setHeight(30f);
|
||||||
|
root_child1.addChildAt(root_child1_child3, 3);
|
||||||
|
|
||||||
|
final YogaNode root_child1_child4 = createNode(config);
|
||||||
|
root_child1_child4.setMargin(YogaEdge.RIGHT, 20f);
|
||||||
|
root_child1_child4.setWidth(30f);
|
||||||
|
root_child1_child4.setHeight(30f);
|
||||||
|
root_child1.addChildAt(root_child1_child4, 4);
|
||||||
|
|
||||||
|
final YogaNode root_child2 = createNode(config);
|
||||||
|
root_child2.setMargin(YogaEdge.LEFT, 20f);
|
||||||
|
root_child2.setWidth(50f);
|
||||||
|
root_child2.setHeight(50f);
|
||||||
|
root.addChildAt(root_child2, 2);
|
||||||
|
root.setDirection(YogaDirection.LTR);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(400f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(140f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(20f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(20f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(140f, root_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(20f, root_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(170f, root_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(50f, root_child1_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(100f, root_child1_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child1_child3.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(50f, root_child1_child3.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child3.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child3.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(50f, root_child1_child4.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(50f, root_child1_child4.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child4.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child4.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(330f, root_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(20f, root_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
root.setDirection(YogaDirection.RTL);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(400f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(140f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(260f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(20f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(90f, root_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(20f, root_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(170f, root_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(120f, root_child1_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(70f, root_child1_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(20f, root_child1_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(120f, root_child1_child3.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(50f, root_child1_child3.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child3.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child3.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(70f, root_child1_child4.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(50f, root_child1_child4.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child4.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(30f, root_child1_child4.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(40f, root_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(20f, root_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(50f, root_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
private YogaNode createNode(YogaConfig config) {
|
private YogaNode createNode(YogaConfig config) {
|
||||||
return mNodeFactory.create(config);
|
return mNodeFactory.create(config);
|
||||||
}
|
}
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*
|
*
|
||||||
* @generated SignedSource<<90f151e3c55d956805a9f44153f87ad0>>
|
* @generated SignedSource<<eccd0d7943f0a1c5cc7ae1bee6dcb5d8>>
|
||||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAlignContentTest.html
|
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAlignContentTest.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -4931,3 +4931,500 @@ test('align_content_space_around_and_align_items_flex_start_with_flex_wrap', ()
|
|||||||
config.free();
|
config.free();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
test('align_content_flex_start_stretch_doesnt_influence_line_box_dim', () => {
|
||||||
|
const config = Yoga.Config.create();
|
||||||
|
let root;
|
||||||
|
|
||||||
|
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||||
|
|
||||||
|
try {
|
||||||
|
root = Yoga.Node.create(config);
|
||||||
|
root.setFlexDirection(FlexDirection.Row);
|
||||||
|
root.setPositionType(PositionType.Absolute);
|
||||||
|
root.setPadding(Edge.Left, 20);
|
||||||
|
root.setPadding(Edge.Top, 20);
|
||||||
|
root.setPadding(Edge.Right, 20);
|
||||||
|
root.setPadding(Edge.Bottom, 20);
|
||||||
|
root.setWidth(400);
|
||||||
|
|
||||||
|
const root_child0 = Yoga.Node.create(config);
|
||||||
|
root_child0.setMargin(Edge.Right, 20);
|
||||||
|
root_child0.setWidth(100);
|
||||||
|
root_child0.setHeight(100);
|
||||||
|
root.insertChild(root_child0, 0);
|
||||||
|
|
||||||
|
const root_child1 = Yoga.Node.create(config);
|
||||||
|
root_child1.setFlexDirection(FlexDirection.Row);
|
||||||
|
root_child1.setFlexWrap(Wrap.Wrap);
|
||||||
|
root_child1.setFlexGrow(1);
|
||||||
|
root_child1.setFlexShrink(1);
|
||||||
|
root.insertChild(root_child1, 1);
|
||||||
|
|
||||||
|
const root_child1_child0 = Yoga.Node.create(config);
|
||||||
|
root_child1_child0.setMargin(Edge.Right, 20);
|
||||||
|
root_child1_child0.setWidth(30);
|
||||||
|
root_child1_child0.setHeight(30);
|
||||||
|
root_child1.insertChild(root_child1_child0, 0);
|
||||||
|
|
||||||
|
const root_child1_child1 = Yoga.Node.create(config);
|
||||||
|
root_child1_child1.setMargin(Edge.Right, 20);
|
||||||
|
root_child1_child1.setWidth(30);
|
||||||
|
root_child1_child1.setHeight(30);
|
||||||
|
root_child1.insertChild(root_child1_child1, 1);
|
||||||
|
|
||||||
|
const root_child1_child2 = Yoga.Node.create(config);
|
||||||
|
root_child1_child2.setMargin(Edge.Right, 20);
|
||||||
|
root_child1_child2.setWidth(30);
|
||||||
|
root_child1_child2.setHeight(30);
|
||||||
|
root_child1.insertChild(root_child1_child2, 2);
|
||||||
|
|
||||||
|
const root_child1_child3 = Yoga.Node.create(config);
|
||||||
|
root_child1_child3.setMargin(Edge.Right, 20);
|
||||||
|
root_child1_child3.setWidth(30);
|
||||||
|
root_child1_child3.setHeight(30);
|
||||||
|
root_child1.insertChild(root_child1_child3, 3);
|
||||||
|
|
||||||
|
const root_child1_child4 = Yoga.Node.create(config);
|
||||||
|
root_child1_child4.setMargin(Edge.Right, 20);
|
||||||
|
root_child1_child4.setWidth(30);
|
||||||
|
root_child1_child4.setHeight(30);
|
||||||
|
root_child1.insertChild(root_child1_child4, 4);
|
||||||
|
|
||||||
|
const root_child2 = Yoga.Node.create(config);
|
||||||
|
root_child2.setMargin(Edge.Left, 20);
|
||||||
|
root_child2.setWidth(50);
|
||||||
|
root_child2.setHeight(50);
|
||||||
|
root.insertChild(root_child2, 2);
|
||||||
|
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||||
|
|
||||||
|
expect(root.getComputedLeft()).toBe(0);
|
||||||
|
expect(root.getComputedTop()).toBe(0);
|
||||||
|
expect(root.getComputedWidth()).toBe(400);
|
||||||
|
expect(root.getComputedHeight()).toBe(140);
|
||||||
|
|
||||||
|
expect(root_child0.getComputedLeft()).toBe(20);
|
||||||
|
expect(root_child0.getComputedTop()).toBe(20);
|
||||||
|
expect(root_child0.getComputedWidth()).toBe(100);
|
||||||
|
expect(root_child0.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child1.getComputedLeft()).toBe(140);
|
||||||
|
expect(root_child1.getComputedTop()).toBe(20);
|
||||||
|
expect(root_child1.getComputedWidth()).toBe(170);
|
||||||
|
expect(root_child1.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child1_child0.getComputedLeft()).toBe(0);
|
||||||
|
expect(root_child1_child0.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child1_child0.getComputedWidth()).toBe(30);
|
||||||
|
expect(root_child1_child0.getComputedHeight()).toBe(30);
|
||||||
|
|
||||||
|
expect(root_child1_child1.getComputedLeft()).toBe(50);
|
||||||
|
expect(root_child1_child1.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child1_child1.getComputedWidth()).toBe(30);
|
||||||
|
expect(root_child1_child1.getComputedHeight()).toBe(30);
|
||||||
|
|
||||||
|
expect(root_child1_child2.getComputedLeft()).toBe(100);
|
||||||
|
expect(root_child1_child2.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child1_child2.getComputedWidth()).toBe(30);
|
||||||
|
expect(root_child1_child2.getComputedHeight()).toBe(30);
|
||||||
|
|
||||||
|
expect(root_child1_child3.getComputedLeft()).toBe(0);
|
||||||
|
expect(root_child1_child3.getComputedTop()).toBe(30);
|
||||||
|
expect(root_child1_child3.getComputedWidth()).toBe(30);
|
||||||
|
expect(root_child1_child3.getComputedHeight()).toBe(30);
|
||||||
|
|
||||||
|
expect(root_child1_child4.getComputedLeft()).toBe(50);
|
||||||
|
expect(root_child1_child4.getComputedTop()).toBe(30);
|
||||||
|
expect(root_child1_child4.getComputedWidth()).toBe(30);
|
||||||
|
expect(root_child1_child4.getComputedHeight()).toBe(30);
|
||||||
|
|
||||||
|
expect(root_child2.getComputedLeft()).toBe(330);
|
||||||
|
expect(root_child2.getComputedTop()).toBe(20);
|
||||||
|
expect(root_child2.getComputedWidth()).toBe(50);
|
||||||
|
expect(root_child2.getComputedHeight()).toBe(50);
|
||||||
|
|
||||||
|
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||||
|
|
||||||
|
expect(root.getComputedLeft()).toBe(0);
|
||||||
|
expect(root.getComputedTop()).toBe(0);
|
||||||
|
expect(root.getComputedWidth()).toBe(400);
|
||||||
|
expect(root.getComputedHeight()).toBe(140);
|
||||||
|
|
||||||
|
expect(root_child0.getComputedLeft()).toBe(260);
|
||||||
|
expect(root_child0.getComputedTop()).toBe(20);
|
||||||
|
expect(root_child0.getComputedWidth()).toBe(100);
|
||||||
|
expect(root_child0.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child1.getComputedLeft()).toBe(90);
|
||||||
|
expect(root_child1.getComputedTop()).toBe(20);
|
||||||
|
expect(root_child1.getComputedWidth()).toBe(170);
|
||||||
|
expect(root_child1.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child1_child0.getComputedLeft()).toBe(120);
|
||||||
|
expect(root_child1_child0.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child1_child0.getComputedWidth()).toBe(30);
|
||||||
|
expect(root_child1_child0.getComputedHeight()).toBe(30);
|
||||||
|
|
||||||
|
expect(root_child1_child1.getComputedLeft()).toBe(70);
|
||||||
|
expect(root_child1_child1.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child1_child1.getComputedWidth()).toBe(30);
|
||||||
|
expect(root_child1_child1.getComputedHeight()).toBe(30);
|
||||||
|
|
||||||
|
expect(root_child1_child2.getComputedLeft()).toBe(20);
|
||||||
|
expect(root_child1_child2.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child1_child2.getComputedWidth()).toBe(30);
|
||||||
|
expect(root_child1_child2.getComputedHeight()).toBe(30);
|
||||||
|
|
||||||
|
expect(root_child1_child3.getComputedLeft()).toBe(120);
|
||||||
|
expect(root_child1_child3.getComputedTop()).toBe(30);
|
||||||
|
expect(root_child1_child3.getComputedWidth()).toBe(30);
|
||||||
|
expect(root_child1_child3.getComputedHeight()).toBe(30);
|
||||||
|
|
||||||
|
expect(root_child1_child4.getComputedLeft()).toBe(70);
|
||||||
|
expect(root_child1_child4.getComputedTop()).toBe(30);
|
||||||
|
expect(root_child1_child4.getComputedWidth()).toBe(30);
|
||||||
|
expect(root_child1_child4.getComputedHeight()).toBe(30);
|
||||||
|
|
||||||
|
expect(root_child2.getComputedLeft()).toBe(40);
|
||||||
|
expect(root_child2.getComputedTop()).toBe(20);
|
||||||
|
expect(root_child2.getComputedWidth()).toBe(50);
|
||||||
|
expect(root_child2.getComputedHeight()).toBe(50);
|
||||||
|
} finally {
|
||||||
|
if (typeof root !== 'undefined') {
|
||||||
|
root.freeRecursive();
|
||||||
|
}
|
||||||
|
|
||||||
|
config.free();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
test('align_content_stretch_stretch_does_influence_line_box_dim', () => {
|
||||||
|
const config = Yoga.Config.create();
|
||||||
|
let root;
|
||||||
|
|
||||||
|
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||||
|
|
||||||
|
try {
|
||||||
|
root = Yoga.Node.create(config);
|
||||||
|
root.setFlexDirection(FlexDirection.Row);
|
||||||
|
root.setPositionType(PositionType.Absolute);
|
||||||
|
root.setPadding(Edge.Left, 20);
|
||||||
|
root.setPadding(Edge.Top, 20);
|
||||||
|
root.setPadding(Edge.Right, 20);
|
||||||
|
root.setPadding(Edge.Bottom, 20);
|
||||||
|
root.setWidth(400);
|
||||||
|
|
||||||
|
const root_child0 = Yoga.Node.create(config);
|
||||||
|
root_child0.setMargin(Edge.Right, 20);
|
||||||
|
root_child0.setWidth(100);
|
||||||
|
root_child0.setHeight(100);
|
||||||
|
root.insertChild(root_child0, 0);
|
||||||
|
|
||||||
|
const root_child1 = Yoga.Node.create(config);
|
||||||
|
root_child1.setFlexDirection(FlexDirection.Row);
|
||||||
|
root_child1.setAlignContent(Align.Stretch);
|
||||||
|
root_child1.setFlexWrap(Wrap.Wrap);
|
||||||
|
root_child1.setFlexGrow(1);
|
||||||
|
root_child1.setFlexShrink(1);
|
||||||
|
root.insertChild(root_child1, 1);
|
||||||
|
|
||||||
|
const root_child1_child0 = Yoga.Node.create(config);
|
||||||
|
root_child1_child0.setMargin(Edge.Right, 20);
|
||||||
|
root_child1_child0.setWidth(30);
|
||||||
|
root_child1_child0.setHeight(30);
|
||||||
|
root_child1.insertChild(root_child1_child0, 0);
|
||||||
|
|
||||||
|
const root_child1_child1 = Yoga.Node.create(config);
|
||||||
|
root_child1_child1.setMargin(Edge.Right, 20);
|
||||||
|
root_child1_child1.setWidth(30);
|
||||||
|
root_child1_child1.setHeight(30);
|
||||||
|
root_child1.insertChild(root_child1_child1, 1);
|
||||||
|
|
||||||
|
const root_child1_child2 = Yoga.Node.create(config);
|
||||||
|
root_child1_child2.setMargin(Edge.Right, 20);
|
||||||
|
root_child1_child2.setWidth(30);
|
||||||
|
root_child1_child2.setHeight(30);
|
||||||
|
root_child1.insertChild(root_child1_child2, 2);
|
||||||
|
|
||||||
|
const root_child1_child3 = Yoga.Node.create(config);
|
||||||
|
root_child1_child3.setMargin(Edge.Right, 20);
|
||||||
|
root_child1_child3.setWidth(30);
|
||||||
|
root_child1_child3.setHeight(30);
|
||||||
|
root_child1.insertChild(root_child1_child3, 3);
|
||||||
|
|
||||||
|
const root_child1_child4 = Yoga.Node.create(config);
|
||||||
|
root_child1_child4.setMargin(Edge.Right, 20);
|
||||||
|
root_child1_child4.setWidth(30);
|
||||||
|
root_child1_child4.setHeight(30);
|
||||||
|
root_child1.insertChild(root_child1_child4, 4);
|
||||||
|
|
||||||
|
const root_child2 = Yoga.Node.create(config);
|
||||||
|
root_child2.setMargin(Edge.Left, 20);
|
||||||
|
root_child2.setWidth(50);
|
||||||
|
root_child2.setHeight(50);
|
||||||
|
root.insertChild(root_child2, 2);
|
||||||
|
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||||
|
|
||||||
|
expect(root.getComputedLeft()).toBe(0);
|
||||||
|
expect(root.getComputedTop()).toBe(0);
|
||||||
|
expect(root.getComputedWidth()).toBe(400);
|
||||||
|
expect(root.getComputedHeight()).toBe(140);
|
||||||
|
|
||||||
|
expect(root_child0.getComputedLeft()).toBe(20);
|
||||||
|
expect(root_child0.getComputedTop()).toBe(20);
|
||||||
|
expect(root_child0.getComputedWidth()).toBe(100);
|
||||||
|
expect(root_child0.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child1.getComputedLeft()).toBe(140);
|
||||||
|
expect(root_child1.getComputedTop()).toBe(20);
|
||||||
|
expect(root_child1.getComputedWidth()).toBe(170);
|
||||||
|
expect(root_child1.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child1_child0.getComputedLeft()).toBe(0);
|
||||||
|
expect(root_child1_child0.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child1_child0.getComputedWidth()).toBe(30);
|
||||||
|
expect(root_child1_child0.getComputedHeight()).toBe(30);
|
||||||
|
|
||||||
|
expect(root_child1_child1.getComputedLeft()).toBe(50);
|
||||||
|
expect(root_child1_child1.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child1_child1.getComputedWidth()).toBe(30);
|
||||||
|
expect(root_child1_child1.getComputedHeight()).toBe(30);
|
||||||
|
|
||||||
|
expect(root_child1_child2.getComputedLeft()).toBe(100);
|
||||||
|
expect(root_child1_child2.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child1_child2.getComputedWidth()).toBe(30);
|
||||||
|
expect(root_child1_child2.getComputedHeight()).toBe(30);
|
||||||
|
|
||||||
|
expect(root_child1_child3.getComputedLeft()).toBe(0);
|
||||||
|
expect(root_child1_child3.getComputedTop()).toBe(50);
|
||||||
|
expect(root_child1_child3.getComputedWidth()).toBe(30);
|
||||||
|
expect(root_child1_child3.getComputedHeight()).toBe(30);
|
||||||
|
|
||||||
|
expect(root_child1_child4.getComputedLeft()).toBe(50);
|
||||||
|
expect(root_child1_child4.getComputedTop()).toBe(50);
|
||||||
|
expect(root_child1_child4.getComputedWidth()).toBe(30);
|
||||||
|
expect(root_child1_child4.getComputedHeight()).toBe(30);
|
||||||
|
|
||||||
|
expect(root_child2.getComputedLeft()).toBe(330);
|
||||||
|
expect(root_child2.getComputedTop()).toBe(20);
|
||||||
|
expect(root_child2.getComputedWidth()).toBe(50);
|
||||||
|
expect(root_child2.getComputedHeight()).toBe(50);
|
||||||
|
|
||||||
|
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||||
|
|
||||||
|
expect(root.getComputedLeft()).toBe(0);
|
||||||
|
expect(root.getComputedTop()).toBe(0);
|
||||||
|
expect(root.getComputedWidth()).toBe(400);
|
||||||
|
expect(root.getComputedHeight()).toBe(140);
|
||||||
|
|
||||||
|
expect(root_child0.getComputedLeft()).toBe(260);
|
||||||
|
expect(root_child0.getComputedTop()).toBe(20);
|
||||||
|
expect(root_child0.getComputedWidth()).toBe(100);
|
||||||
|
expect(root_child0.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child1.getComputedLeft()).toBe(90);
|
||||||
|
expect(root_child1.getComputedTop()).toBe(20);
|
||||||
|
expect(root_child1.getComputedWidth()).toBe(170);
|
||||||
|
expect(root_child1.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child1_child0.getComputedLeft()).toBe(120);
|
||||||
|
expect(root_child1_child0.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child1_child0.getComputedWidth()).toBe(30);
|
||||||
|
expect(root_child1_child0.getComputedHeight()).toBe(30);
|
||||||
|
|
||||||
|
expect(root_child1_child1.getComputedLeft()).toBe(70);
|
||||||
|
expect(root_child1_child1.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child1_child1.getComputedWidth()).toBe(30);
|
||||||
|
expect(root_child1_child1.getComputedHeight()).toBe(30);
|
||||||
|
|
||||||
|
expect(root_child1_child2.getComputedLeft()).toBe(20);
|
||||||
|
expect(root_child1_child2.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child1_child2.getComputedWidth()).toBe(30);
|
||||||
|
expect(root_child1_child2.getComputedHeight()).toBe(30);
|
||||||
|
|
||||||
|
expect(root_child1_child3.getComputedLeft()).toBe(120);
|
||||||
|
expect(root_child1_child3.getComputedTop()).toBe(50);
|
||||||
|
expect(root_child1_child3.getComputedWidth()).toBe(30);
|
||||||
|
expect(root_child1_child3.getComputedHeight()).toBe(30);
|
||||||
|
|
||||||
|
expect(root_child1_child4.getComputedLeft()).toBe(70);
|
||||||
|
expect(root_child1_child4.getComputedTop()).toBe(50);
|
||||||
|
expect(root_child1_child4.getComputedWidth()).toBe(30);
|
||||||
|
expect(root_child1_child4.getComputedHeight()).toBe(30);
|
||||||
|
|
||||||
|
expect(root_child2.getComputedLeft()).toBe(40);
|
||||||
|
expect(root_child2.getComputedTop()).toBe(20);
|
||||||
|
expect(root_child2.getComputedWidth()).toBe(50);
|
||||||
|
expect(root_child2.getComputedHeight()).toBe(50);
|
||||||
|
} finally {
|
||||||
|
if (typeof root !== 'undefined') {
|
||||||
|
root.freeRecursive();
|
||||||
|
}
|
||||||
|
|
||||||
|
config.free();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
test('align_content_space_evenly_stretch_does_influence_line_box_dim', () => {
|
||||||
|
const config = Yoga.Config.create();
|
||||||
|
let root;
|
||||||
|
|
||||||
|
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||||
|
|
||||||
|
try {
|
||||||
|
root = Yoga.Node.create(config);
|
||||||
|
root.setFlexDirection(FlexDirection.Row);
|
||||||
|
root.setPositionType(PositionType.Absolute);
|
||||||
|
root.setPadding(Edge.Left, 20);
|
||||||
|
root.setPadding(Edge.Top, 20);
|
||||||
|
root.setPadding(Edge.Right, 20);
|
||||||
|
root.setPadding(Edge.Bottom, 20);
|
||||||
|
root.setWidth(400);
|
||||||
|
|
||||||
|
const root_child0 = Yoga.Node.create(config);
|
||||||
|
root_child0.setMargin(Edge.Right, 20);
|
||||||
|
root_child0.setWidth(100);
|
||||||
|
root_child0.setHeight(100);
|
||||||
|
root.insertChild(root_child0, 0);
|
||||||
|
|
||||||
|
const root_child1 = Yoga.Node.create(config);
|
||||||
|
root_child1.setFlexDirection(FlexDirection.Row);
|
||||||
|
root_child1.setAlignContent(Align.Stretch);
|
||||||
|
root_child1.setFlexWrap(Wrap.Wrap);
|
||||||
|
root_child1.setFlexGrow(1);
|
||||||
|
root_child1.setFlexShrink(1);
|
||||||
|
root.insertChild(root_child1, 1);
|
||||||
|
|
||||||
|
const root_child1_child0 = Yoga.Node.create(config);
|
||||||
|
root_child1_child0.setMargin(Edge.Right, 20);
|
||||||
|
root_child1_child0.setWidth(30);
|
||||||
|
root_child1_child0.setHeight(30);
|
||||||
|
root_child1.insertChild(root_child1_child0, 0);
|
||||||
|
|
||||||
|
const root_child1_child1 = Yoga.Node.create(config);
|
||||||
|
root_child1_child1.setMargin(Edge.Right, 20);
|
||||||
|
root_child1_child1.setWidth(30);
|
||||||
|
root_child1_child1.setHeight(30);
|
||||||
|
root_child1.insertChild(root_child1_child1, 1);
|
||||||
|
|
||||||
|
const root_child1_child2 = Yoga.Node.create(config);
|
||||||
|
root_child1_child2.setMargin(Edge.Right, 20);
|
||||||
|
root_child1_child2.setWidth(30);
|
||||||
|
root_child1_child2.setHeight(30);
|
||||||
|
root_child1.insertChild(root_child1_child2, 2);
|
||||||
|
|
||||||
|
const root_child1_child3 = Yoga.Node.create(config);
|
||||||
|
root_child1_child3.setMargin(Edge.Right, 20);
|
||||||
|
root_child1_child3.setWidth(30);
|
||||||
|
root_child1_child3.setHeight(30);
|
||||||
|
root_child1.insertChild(root_child1_child3, 3);
|
||||||
|
|
||||||
|
const root_child1_child4 = Yoga.Node.create(config);
|
||||||
|
root_child1_child4.setMargin(Edge.Right, 20);
|
||||||
|
root_child1_child4.setWidth(30);
|
||||||
|
root_child1_child4.setHeight(30);
|
||||||
|
root_child1.insertChild(root_child1_child4, 4);
|
||||||
|
|
||||||
|
const root_child2 = Yoga.Node.create(config);
|
||||||
|
root_child2.setMargin(Edge.Left, 20);
|
||||||
|
root_child2.setWidth(50);
|
||||||
|
root_child2.setHeight(50);
|
||||||
|
root.insertChild(root_child2, 2);
|
||||||
|
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||||
|
|
||||||
|
expect(root.getComputedLeft()).toBe(0);
|
||||||
|
expect(root.getComputedTop()).toBe(0);
|
||||||
|
expect(root.getComputedWidth()).toBe(400);
|
||||||
|
expect(root.getComputedHeight()).toBe(140);
|
||||||
|
|
||||||
|
expect(root_child0.getComputedLeft()).toBe(20);
|
||||||
|
expect(root_child0.getComputedTop()).toBe(20);
|
||||||
|
expect(root_child0.getComputedWidth()).toBe(100);
|
||||||
|
expect(root_child0.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child1.getComputedLeft()).toBe(140);
|
||||||
|
expect(root_child1.getComputedTop()).toBe(20);
|
||||||
|
expect(root_child1.getComputedWidth()).toBe(170);
|
||||||
|
expect(root_child1.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child1_child0.getComputedLeft()).toBe(0);
|
||||||
|
expect(root_child1_child0.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child1_child0.getComputedWidth()).toBe(30);
|
||||||
|
expect(root_child1_child0.getComputedHeight()).toBe(30);
|
||||||
|
|
||||||
|
expect(root_child1_child1.getComputedLeft()).toBe(50);
|
||||||
|
expect(root_child1_child1.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child1_child1.getComputedWidth()).toBe(30);
|
||||||
|
expect(root_child1_child1.getComputedHeight()).toBe(30);
|
||||||
|
|
||||||
|
expect(root_child1_child2.getComputedLeft()).toBe(100);
|
||||||
|
expect(root_child1_child2.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child1_child2.getComputedWidth()).toBe(30);
|
||||||
|
expect(root_child1_child2.getComputedHeight()).toBe(30);
|
||||||
|
|
||||||
|
expect(root_child1_child3.getComputedLeft()).toBe(0);
|
||||||
|
expect(root_child1_child3.getComputedTop()).toBe(50);
|
||||||
|
expect(root_child1_child3.getComputedWidth()).toBe(30);
|
||||||
|
expect(root_child1_child3.getComputedHeight()).toBe(30);
|
||||||
|
|
||||||
|
expect(root_child1_child4.getComputedLeft()).toBe(50);
|
||||||
|
expect(root_child1_child4.getComputedTop()).toBe(50);
|
||||||
|
expect(root_child1_child4.getComputedWidth()).toBe(30);
|
||||||
|
expect(root_child1_child4.getComputedHeight()).toBe(30);
|
||||||
|
|
||||||
|
expect(root_child2.getComputedLeft()).toBe(330);
|
||||||
|
expect(root_child2.getComputedTop()).toBe(20);
|
||||||
|
expect(root_child2.getComputedWidth()).toBe(50);
|
||||||
|
expect(root_child2.getComputedHeight()).toBe(50);
|
||||||
|
|
||||||
|
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||||
|
|
||||||
|
expect(root.getComputedLeft()).toBe(0);
|
||||||
|
expect(root.getComputedTop()).toBe(0);
|
||||||
|
expect(root.getComputedWidth()).toBe(400);
|
||||||
|
expect(root.getComputedHeight()).toBe(140);
|
||||||
|
|
||||||
|
expect(root_child0.getComputedLeft()).toBe(260);
|
||||||
|
expect(root_child0.getComputedTop()).toBe(20);
|
||||||
|
expect(root_child0.getComputedWidth()).toBe(100);
|
||||||
|
expect(root_child0.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child1.getComputedLeft()).toBe(90);
|
||||||
|
expect(root_child1.getComputedTop()).toBe(20);
|
||||||
|
expect(root_child1.getComputedWidth()).toBe(170);
|
||||||
|
expect(root_child1.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child1_child0.getComputedLeft()).toBe(120);
|
||||||
|
expect(root_child1_child0.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child1_child0.getComputedWidth()).toBe(30);
|
||||||
|
expect(root_child1_child0.getComputedHeight()).toBe(30);
|
||||||
|
|
||||||
|
expect(root_child1_child1.getComputedLeft()).toBe(70);
|
||||||
|
expect(root_child1_child1.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child1_child1.getComputedWidth()).toBe(30);
|
||||||
|
expect(root_child1_child1.getComputedHeight()).toBe(30);
|
||||||
|
|
||||||
|
expect(root_child1_child2.getComputedLeft()).toBe(20);
|
||||||
|
expect(root_child1_child2.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child1_child2.getComputedWidth()).toBe(30);
|
||||||
|
expect(root_child1_child2.getComputedHeight()).toBe(30);
|
||||||
|
|
||||||
|
expect(root_child1_child3.getComputedLeft()).toBe(120);
|
||||||
|
expect(root_child1_child3.getComputedTop()).toBe(50);
|
||||||
|
expect(root_child1_child3.getComputedWidth()).toBe(30);
|
||||||
|
expect(root_child1_child3.getComputedHeight()).toBe(30);
|
||||||
|
|
||||||
|
expect(root_child1_child4.getComputedLeft()).toBe(70);
|
||||||
|
expect(root_child1_child4.getComputedTop()).toBe(50);
|
||||||
|
expect(root_child1_child4.getComputedWidth()).toBe(30);
|
||||||
|
expect(root_child1_child4.getComputedHeight()).toBe(30);
|
||||||
|
|
||||||
|
expect(root_child2.getComputedLeft()).toBe(40);
|
||||||
|
expect(root_child2.getComputedTop()).toBe(20);
|
||||||
|
expect(root_child2.getComputedWidth()).toBe(50);
|
||||||
|
expect(root_child2.getComputedHeight()).toBe(50);
|
||||||
|
} finally {
|
||||||
|
if (typeof root !== 'undefined') {
|
||||||
|
root.freeRecursive();
|
||||||
|
}
|
||||||
|
|
||||||
|
config.free();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*
|
*
|
||||||
* clang-format off
|
* clang-format off
|
||||||
* @generated SignedSource<<b6027cb8fdecc58504c96fe2201d909b>>
|
* @generated SignedSource<<7756efeafb66f705aecda51d7d361f2f>>
|
||||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAlignContentTest.html
|
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAlignContentTest.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -4641,3 +4641,485 @@ TEST(YogaTest, align_content_space_around_and_align_items_flex_start_with_flex_w
|
|||||||
|
|
||||||
YGConfigFree(config);
|
YGConfigFree(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, align_content_flex_start_stretch_doesnt_influence_line_box_dim) {
|
||||||
|
const YGConfigRef config = YGConfigNew();
|
||||||
|
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||||
|
|
||||||
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||||
|
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||||
|
YGNodeStyleSetPadding(root, YGEdgeLeft, 20);
|
||||||
|
YGNodeStyleSetPadding(root, YGEdgeTop, 20);
|
||||||
|
YGNodeStyleSetPadding(root, YGEdgeRight, 20);
|
||||||
|
YGNodeStyleSetPadding(root, YGEdgeBottom, 20);
|
||||||
|
YGNodeStyleSetWidth(root, 400);
|
||||||
|
|
||||||
|
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetMargin(root_child0, YGEdgeRight, 20);
|
||||||
|
YGNodeStyleSetWidth(root_child0, 100);
|
||||||
|
YGNodeStyleSetHeight(root_child0, 100);
|
||||||
|
YGNodeInsertChild(root, root_child0, 0);
|
||||||
|
|
||||||
|
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetFlexDirection(root_child1, YGFlexDirectionRow);
|
||||||
|
YGNodeStyleSetFlexWrap(root_child1, YGWrapWrap);
|
||||||
|
YGNodeStyleSetFlexGrow(root_child1, 1);
|
||||||
|
YGNodeStyleSetFlexShrink(root_child1, 1);
|
||||||
|
YGNodeInsertChild(root, root_child1, 1);
|
||||||
|
|
||||||
|
const YGNodeRef root_child1_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetMargin(root_child1_child0, YGEdgeRight, 20);
|
||||||
|
YGNodeStyleSetWidth(root_child1_child0, 30);
|
||||||
|
YGNodeStyleSetHeight(root_child1_child0, 30);
|
||||||
|
YGNodeInsertChild(root_child1, root_child1_child0, 0);
|
||||||
|
|
||||||
|
const YGNodeRef root_child1_child1 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetMargin(root_child1_child1, YGEdgeRight, 20);
|
||||||
|
YGNodeStyleSetWidth(root_child1_child1, 30);
|
||||||
|
YGNodeStyleSetHeight(root_child1_child1, 30);
|
||||||
|
YGNodeInsertChild(root_child1, root_child1_child1, 1);
|
||||||
|
|
||||||
|
const YGNodeRef root_child1_child2 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetMargin(root_child1_child2, YGEdgeRight, 20);
|
||||||
|
YGNodeStyleSetWidth(root_child1_child2, 30);
|
||||||
|
YGNodeStyleSetHeight(root_child1_child2, 30);
|
||||||
|
YGNodeInsertChild(root_child1, root_child1_child2, 2);
|
||||||
|
|
||||||
|
const YGNodeRef root_child1_child3 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetMargin(root_child1_child3, YGEdgeRight, 20);
|
||||||
|
YGNodeStyleSetWidth(root_child1_child3, 30);
|
||||||
|
YGNodeStyleSetHeight(root_child1_child3, 30);
|
||||||
|
YGNodeInsertChild(root_child1, root_child1_child3, 3);
|
||||||
|
|
||||||
|
const YGNodeRef root_child1_child4 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetMargin(root_child1_child4, YGEdgeRight, 20);
|
||||||
|
YGNodeStyleSetWidth(root_child1_child4, 30);
|
||||||
|
YGNodeStyleSetHeight(root_child1_child4, 30);
|
||||||
|
YGNodeInsertChild(root_child1, root_child1_child4, 4);
|
||||||
|
|
||||||
|
const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetMargin(root_child2, YGEdgeLeft, 20);
|
||||||
|
YGNodeStyleSetWidth(root_child2, 50);
|
||||||
|
YGNodeStyleSetHeight(root_child2, 50);
|
||||||
|
YGNodeInsertChild(root, root_child2, 2);
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(140, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(140, YGNodeLayoutGetLeft(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(170, YGNodeLayoutGetWidth(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1_child0));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child1_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1_child1));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child1));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1_child1));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child1_child1));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child1_child2));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child2));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1_child2));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child1_child2));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child3));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetTop(root_child1_child3));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1_child3));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child1_child3));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1_child4));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetTop(root_child1_child4));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1_child4));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child1_child4));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(330, YGNodeLayoutGetLeft(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child2));
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(140, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(260, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(170, YGNodeLayoutGetWidth(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(120, YGNodeLayoutGetLeft(root_child1_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1_child0));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child1_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(70, YGNodeLayoutGetLeft(root_child1_child1));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child1));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1_child1));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child1_child1));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child1_child2));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child2));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1_child2));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child1_child2));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(120, YGNodeLayoutGetLeft(root_child1_child3));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetTop(root_child1_child3));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1_child3));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child1_child3));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(70, YGNodeLayoutGetLeft(root_child1_child4));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetTop(root_child1_child4));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1_child4));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child1_child4));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetLeft(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child2));
|
||||||
|
|
||||||
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
|
YGConfigFree(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, align_content_stretch_stretch_does_influence_line_box_dim) {
|
||||||
|
const YGConfigRef config = YGConfigNew();
|
||||||
|
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||||
|
|
||||||
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||||
|
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||||
|
YGNodeStyleSetPadding(root, YGEdgeLeft, 20);
|
||||||
|
YGNodeStyleSetPadding(root, YGEdgeTop, 20);
|
||||||
|
YGNodeStyleSetPadding(root, YGEdgeRight, 20);
|
||||||
|
YGNodeStyleSetPadding(root, YGEdgeBottom, 20);
|
||||||
|
YGNodeStyleSetWidth(root, 400);
|
||||||
|
|
||||||
|
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetMargin(root_child0, YGEdgeRight, 20);
|
||||||
|
YGNodeStyleSetWidth(root_child0, 100);
|
||||||
|
YGNodeStyleSetHeight(root_child0, 100);
|
||||||
|
YGNodeInsertChild(root, root_child0, 0);
|
||||||
|
|
||||||
|
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetFlexDirection(root_child1, YGFlexDirectionRow);
|
||||||
|
YGNodeStyleSetAlignContent(root_child1, YGAlignStretch);
|
||||||
|
YGNodeStyleSetFlexWrap(root_child1, YGWrapWrap);
|
||||||
|
YGNodeStyleSetFlexGrow(root_child1, 1);
|
||||||
|
YGNodeStyleSetFlexShrink(root_child1, 1);
|
||||||
|
YGNodeInsertChild(root, root_child1, 1);
|
||||||
|
|
||||||
|
const YGNodeRef root_child1_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetMargin(root_child1_child0, YGEdgeRight, 20);
|
||||||
|
YGNodeStyleSetWidth(root_child1_child0, 30);
|
||||||
|
YGNodeStyleSetHeight(root_child1_child0, 30);
|
||||||
|
YGNodeInsertChild(root_child1, root_child1_child0, 0);
|
||||||
|
|
||||||
|
const YGNodeRef root_child1_child1 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetMargin(root_child1_child1, YGEdgeRight, 20);
|
||||||
|
YGNodeStyleSetWidth(root_child1_child1, 30);
|
||||||
|
YGNodeStyleSetHeight(root_child1_child1, 30);
|
||||||
|
YGNodeInsertChild(root_child1, root_child1_child1, 1);
|
||||||
|
|
||||||
|
const YGNodeRef root_child1_child2 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetMargin(root_child1_child2, YGEdgeRight, 20);
|
||||||
|
YGNodeStyleSetWidth(root_child1_child2, 30);
|
||||||
|
YGNodeStyleSetHeight(root_child1_child2, 30);
|
||||||
|
YGNodeInsertChild(root_child1, root_child1_child2, 2);
|
||||||
|
|
||||||
|
const YGNodeRef root_child1_child3 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetMargin(root_child1_child3, YGEdgeRight, 20);
|
||||||
|
YGNodeStyleSetWidth(root_child1_child3, 30);
|
||||||
|
YGNodeStyleSetHeight(root_child1_child3, 30);
|
||||||
|
YGNodeInsertChild(root_child1, root_child1_child3, 3);
|
||||||
|
|
||||||
|
const YGNodeRef root_child1_child4 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetMargin(root_child1_child4, YGEdgeRight, 20);
|
||||||
|
YGNodeStyleSetWidth(root_child1_child4, 30);
|
||||||
|
YGNodeStyleSetHeight(root_child1_child4, 30);
|
||||||
|
YGNodeInsertChild(root_child1, root_child1_child4, 4);
|
||||||
|
|
||||||
|
const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetMargin(root_child2, YGEdgeLeft, 20);
|
||||||
|
YGNodeStyleSetWidth(root_child2, 50);
|
||||||
|
YGNodeStyleSetHeight(root_child2, 50);
|
||||||
|
YGNodeInsertChild(root, root_child2, 2);
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(140, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(140, YGNodeLayoutGetLeft(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(170, YGNodeLayoutGetWidth(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1_child0));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child1_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1_child1));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child1));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1_child1));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child1_child1));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child1_child2));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child2));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1_child2));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child1_child2));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child3));
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child1_child3));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1_child3));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child1_child3));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1_child4));
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child1_child4));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1_child4));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child1_child4));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(330, YGNodeLayoutGetLeft(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child2));
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(140, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(260, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(170, YGNodeLayoutGetWidth(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(120, YGNodeLayoutGetLeft(root_child1_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1_child0));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child1_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(70, YGNodeLayoutGetLeft(root_child1_child1));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child1));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1_child1));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child1_child1));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child1_child2));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child2));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1_child2));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child1_child2));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(120, YGNodeLayoutGetLeft(root_child1_child3));
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child1_child3));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1_child3));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child1_child3));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(70, YGNodeLayoutGetLeft(root_child1_child4));
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child1_child4));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1_child4));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child1_child4));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetLeft(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child2));
|
||||||
|
|
||||||
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
|
YGConfigFree(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, align_content_space_evenly_stretch_does_influence_line_box_dim) {
|
||||||
|
const YGConfigRef config = YGConfigNew();
|
||||||
|
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||||
|
|
||||||
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||||
|
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||||
|
YGNodeStyleSetPadding(root, YGEdgeLeft, 20);
|
||||||
|
YGNodeStyleSetPadding(root, YGEdgeTop, 20);
|
||||||
|
YGNodeStyleSetPadding(root, YGEdgeRight, 20);
|
||||||
|
YGNodeStyleSetPadding(root, YGEdgeBottom, 20);
|
||||||
|
YGNodeStyleSetWidth(root, 400);
|
||||||
|
|
||||||
|
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetMargin(root_child0, YGEdgeRight, 20);
|
||||||
|
YGNodeStyleSetWidth(root_child0, 100);
|
||||||
|
YGNodeStyleSetHeight(root_child0, 100);
|
||||||
|
YGNodeInsertChild(root, root_child0, 0);
|
||||||
|
|
||||||
|
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetFlexDirection(root_child1, YGFlexDirectionRow);
|
||||||
|
YGNodeStyleSetAlignContent(root_child1, YGAlignStretch);
|
||||||
|
YGNodeStyleSetFlexWrap(root_child1, YGWrapWrap);
|
||||||
|
YGNodeStyleSetFlexGrow(root_child1, 1);
|
||||||
|
YGNodeStyleSetFlexShrink(root_child1, 1);
|
||||||
|
YGNodeInsertChild(root, root_child1, 1);
|
||||||
|
|
||||||
|
const YGNodeRef root_child1_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetMargin(root_child1_child0, YGEdgeRight, 20);
|
||||||
|
YGNodeStyleSetWidth(root_child1_child0, 30);
|
||||||
|
YGNodeStyleSetHeight(root_child1_child0, 30);
|
||||||
|
YGNodeInsertChild(root_child1, root_child1_child0, 0);
|
||||||
|
|
||||||
|
const YGNodeRef root_child1_child1 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetMargin(root_child1_child1, YGEdgeRight, 20);
|
||||||
|
YGNodeStyleSetWidth(root_child1_child1, 30);
|
||||||
|
YGNodeStyleSetHeight(root_child1_child1, 30);
|
||||||
|
YGNodeInsertChild(root_child1, root_child1_child1, 1);
|
||||||
|
|
||||||
|
const YGNodeRef root_child1_child2 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetMargin(root_child1_child2, YGEdgeRight, 20);
|
||||||
|
YGNodeStyleSetWidth(root_child1_child2, 30);
|
||||||
|
YGNodeStyleSetHeight(root_child1_child2, 30);
|
||||||
|
YGNodeInsertChild(root_child1, root_child1_child2, 2);
|
||||||
|
|
||||||
|
const YGNodeRef root_child1_child3 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetMargin(root_child1_child3, YGEdgeRight, 20);
|
||||||
|
YGNodeStyleSetWidth(root_child1_child3, 30);
|
||||||
|
YGNodeStyleSetHeight(root_child1_child3, 30);
|
||||||
|
YGNodeInsertChild(root_child1, root_child1_child3, 3);
|
||||||
|
|
||||||
|
const YGNodeRef root_child1_child4 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetMargin(root_child1_child4, YGEdgeRight, 20);
|
||||||
|
YGNodeStyleSetWidth(root_child1_child4, 30);
|
||||||
|
YGNodeStyleSetHeight(root_child1_child4, 30);
|
||||||
|
YGNodeInsertChild(root_child1, root_child1_child4, 4);
|
||||||
|
|
||||||
|
const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetMargin(root_child2, YGEdgeLeft, 20);
|
||||||
|
YGNodeStyleSetWidth(root_child2, 50);
|
||||||
|
YGNodeStyleSetHeight(root_child2, 50);
|
||||||
|
YGNodeInsertChild(root, root_child2, 2);
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(140, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(140, YGNodeLayoutGetLeft(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(170, YGNodeLayoutGetWidth(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1_child0));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child1_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1_child1));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child1));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1_child1));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child1_child1));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child1_child2));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child2));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1_child2));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child1_child2));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child3));
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child1_child3));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1_child3));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child1_child3));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1_child4));
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child1_child4));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1_child4));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child1_child4));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(330, YGNodeLayoutGetLeft(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child2));
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(140, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(260, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(170, YGNodeLayoutGetWidth(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(120, YGNodeLayoutGetLeft(root_child1_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1_child0));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child1_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(70, YGNodeLayoutGetLeft(root_child1_child1));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child1));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1_child1));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child1_child1));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child1_child2));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child2));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1_child2));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child1_child2));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(120, YGNodeLayoutGetLeft(root_child1_child3));
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child1_child3));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1_child3));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child1_child3));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(70, YGNodeLayoutGetLeft(root_child1_child4));
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child1_child4));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetWidth(root_child1_child4));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child1_child4));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetLeft(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child2));
|
||||||
|
|
||||||
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
|
YGConfigFree(config);
|
||||||
|
}
|
||||||
|
@@ -1743,8 +1743,9 @@ static void calculateLayoutImpl(
|
|||||||
float leadPerLine = 0;
|
float leadPerLine = 0;
|
||||||
float currentLead = leadingPaddingAndBorderCross;
|
float currentLead = leadingPaddingAndBorderCross;
|
||||||
|
|
||||||
const float unclampedCrossDim =
|
const float unclampedCrossDim = sizingModeCrossDim == SizingMode::StretchFit
|
||||||
node->styleDefinesDimension(crossAxis, crossAxisownerSize)
|
? availableInnerCrossDim + paddingAndBorderAxisCross
|
||||||
|
: node->styleDefinesDimension(crossAxis, crossAxisownerSize)
|
||||||
? yoga::resolveValue(
|
? yoga::resolveValue(
|
||||||
node->getResolvedDimension(dimension(crossAxis)),
|
node->getResolvedDimension(dimension(crossAxis)),
|
||||||
crossAxisownerSize)
|
crossAxisownerSize)
|
||||||
|
Reference in New Issue
Block a user