Update align-content handling of overflow
Summary: X-link: https://github.com/facebook/react-native/pull/43752 Gentest tests started failing because Chrome changed behavior of overflowed align-content container. Spec says should fallback to "safe center", which is really just "start", instead of previous "center" behavior. This changes behavior accordingly. There is one bit where I think we are doing the wrong thing wrt alignment of flex start vs start (which we don't support yet), but couldn't repro a failing chrome test. Changelog: [Internal] Reviewed By: joevilches Differential Revision: D55617689 fbshipit-source-id: 08f23d198c75f2c2f51ccaa8795289e6e4a92cb8
This commit is contained in:
committed by
Facebook GitHub Bot
parent
f12d436314
commit
6f10656868
@@ -155,6 +155,14 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="align_content_space_between_wrapped_negative_space_row_reverse" style="display: flex; flex-direction: column; width: 320px; height: 320px; border-width: 60px;">
|
||||
<div style="display: flex; flex-direction: row-reverse; flex-wrap: wrap; align-content: space-between; justify-content: center; height: 10px;">
|
||||
<div style="width: 80%; height: 20px; flex-shrink: 0;"></div>
|
||||
<div style="width: 80%; height: 20px; flex-shrink: 0;"></div>
|
||||
<div style="width: 80%; height: 20px; flex-shrink: 0;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="align_content_space_between_wrapped_negative_space_gap" style="display: flex; flex-direction: column; width: 320px; height: 320px; border-width: 60px;">
|
||||
<div style="display: flex; flex-direction: row; flex-wrap: wrap; align-content: space-between; justify-content: center; height: 10px; gap: 10px;">
|
||||
<div style="width: 80%; height: 20px; flex-shrink: 0;"></div>
|
||||
@@ -192,6 +200,14 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="align_content_space_around_wrapped_negative_space_row_reverse" style="display: flex; flex-direction: column; width: 320px; height: 320px; border-width: 60px;">
|
||||
<div style="display: flex; flex-direction: row-reverse; flex-wrap: wrap; align-content: space-around; justify-content: center; height: 10px;">
|
||||
<div style="width: 80%; height: 20px; flex-shrink: 0;"></div>
|
||||
<div style="width: 80%; height: 20px; flex-shrink: 0;"></div>
|
||||
<div style="width: 80%; height: 20px; flex-shrink: 0;"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="align_content_space_around_wrapped_negative_space_gap" style="display: flex; flex-direction: column; width: 320px; height: 320px; border-width: 60px;">
|
||||
<div style="display: flex; flex-direction: row; flex-wrap: wrap; align-content: space-around; justify-content: center; height: 10px; gap: 10px;">
|
||||
<div style="width: 80%; height: 20px; flex-shrink: 0;"></div>
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<d93836c91c231c9c029763da7dc2d911>>
|
||||
* @generated SignedSource<<bd8a962cdd17e27c9a61363c7e25044c>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAlignContentTest.html
|
||||
*/
|
||||
|
||||
@@ -1745,6 +1745,98 @@ public class YGAlignContentTest {
|
||||
assertEquals(20f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_align_content_space_between_wrapped_negative_space_row_reverse() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setBorder(YogaEdge.LEFT, 60f);
|
||||
root.setBorder(YogaEdge.TOP, 60f);
|
||||
root.setBorder(YogaEdge.RIGHT, 60f);
|
||||
root.setBorder(YogaEdge.BOTTOM, 60f);
|
||||
root.setWidth(320f);
|
||||
root.setHeight(320f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
|
||||
root_child0.setJustifyContent(YogaJustify.CENTER);
|
||||
root_child0.setAlignContent(YogaAlign.SPACE_BETWEEN);
|
||||
root_child0.setWrap(YogaWrap.WRAP);
|
||||
root_child0.setHeight(10f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child0_child0 = createNode(config);
|
||||
root_child0_child0.setWidthPercent(80f);
|
||||
root_child0_child0.setHeight(20f);
|
||||
root_child0.addChildAt(root_child0_child0, 0);
|
||||
|
||||
final YogaNode root_child0_child1 = createNode(config);
|
||||
root_child0_child1.setWidthPercent(80f);
|
||||
root_child0_child1.setHeight(20f);
|
||||
root_child0.addChildAt(root_child0_child1, 1);
|
||||
|
||||
final YogaNode root_child0_child2 = createNode(config);
|
||||
root_child0_child2.setWidthPercent(80f);
|
||||
root_child0_child2.setHeight(20f);
|
||||
root_child0.addChildAt(root_child0_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(320f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(320f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(60f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(60f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(40f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_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(320f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(320f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(60f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(60f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(40f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_align_content_space_between_wrapped_negative_space_gap() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
@@ -2106,17 +2198,17 @@ public class YGAlignContentTest {
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(-25f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(-5f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(15f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
@@ -2134,17 +2226,109 @@ public class YGAlignContentTest {
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(-25f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(-5f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(15f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_align_content_space_around_wrapped_negative_space_row_reverse() {
|
||||
YogaConfig config = YogaConfigFactory.create();
|
||||
|
||||
final YogaNode root = createNode(config);
|
||||
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||
root.setBorder(YogaEdge.LEFT, 60f);
|
||||
root.setBorder(YogaEdge.TOP, 60f);
|
||||
root.setBorder(YogaEdge.RIGHT, 60f);
|
||||
root.setBorder(YogaEdge.BOTTOM, 60f);
|
||||
root.setWidth(320f);
|
||||
root.setHeight(320f);
|
||||
|
||||
final YogaNode root_child0 = createNode(config);
|
||||
root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
|
||||
root_child0.setJustifyContent(YogaJustify.CENTER);
|
||||
root_child0.setAlignContent(YogaAlign.SPACE_AROUND);
|
||||
root_child0.setWrap(YogaWrap.WRAP);
|
||||
root_child0.setHeight(10f);
|
||||
root.addChildAt(root_child0, 0);
|
||||
|
||||
final YogaNode root_child0_child0 = createNode(config);
|
||||
root_child0_child0.setWidthPercent(80f);
|
||||
root_child0_child0.setHeight(20f);
|
||||
root_child0.addChildAt(root_child0_child0, 0);
|
||||
|
||||
final YogaNode root_child0_child1 = createNode(config);
|
||||
root_child0_child1.setWidthPercent(80f);
|
||||
root_child0_child1.setHeight(20f);
|
||||
root_child0.addChildAt(root_child0_child1, 1);
|
||||
|
||||
final YogaNode root_child0_child2 = createNode(config);
|
||||
root_child0_child2.setWidthPercent(80f);
|
||||
root_child0_child2.setHeight(20f);
|
||||
root_child0.addChildAt(root_child0_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(320f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(320f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(60f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(60f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(40f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_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(320f, root.getLayoutWidth(), 0.0f);
|
||||
assertEquals(320f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(60f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(60f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(40f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
@@ -2200,17 +2384,17 @@ public class YGAlignContentTest {
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(-35f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(-5f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(30f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(25f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(60f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
@@ -2228,17 +2412,17 @@ public class YGAlignContentTest {
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(-35f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(-5f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(30f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(25f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(60f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
@@ -2510,17 +2694,17 @@ public class YGAlignContentTest {
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(-25f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(-5f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(15f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
@@ -2538,17 +2722,17 @@ public class YGAlignContentTest {
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(-25f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(-5f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(15f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(40f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
@@ -2604,17 +2788,17 @@ public class YGAlignContentTest {
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(-35f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(-5f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(30f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(25f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(60f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||
|
||||
@@ -2632,17 +2816,17 @@ public class YGAlignContentTest {
|
||||
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(-35f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(-5f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(30f, root_child0_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f);
|
||||
assertEquals(25f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(60f, root_child0_child2.getLayoutY(), 0.0f);
|
||||
assertEquals(160f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||
assertEquals(20f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
@@ -4230,12 +4414,12 @@ public class YGAlignContentTest {
|
||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(-50f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(400f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(200f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(150f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(400f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(200f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
@@ -4248,12 +4432,12 @@ public class YGAlignContentTest {
|
||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(100f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(-50f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(400f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(200f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(100f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(150f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(200f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(400f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(200f, root_child1.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
@@ -4296,12 +4480,12 @@ public class YGAlignContentTest {
|
||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(7f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(-50f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(7f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(400f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(200f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(7f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(150f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(207f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(400f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(200f, root_child1.getLayoutHeight(), 0.0f);
|
||||
|
||||
@@ -4314,12 +4498,12 @@ public class YGAlignContentTest {
|
||||
assertEquals(300f, root.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(93f, root_child0.getLayoutX(), 0.0f);
|
||||
assertEquals(-50f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(7f, root_child0.getLayoutY(), 0.0f);
|
||||
assertEquals(400f, root_child0.getLayoutWidth(), 0.0f);
|
||||
assertEquals(200f, root_child0.getLayoutHeight(), 0.0f);
|
||||
|
||||
assertEquals(93f, root_child1.getLayoutX(), 0.0f);
|
||||
assertEquals(150f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(207f, root_child1.getLayoutY(), 0.0f);
|
||||
assertEquals(400f, root_child1.getLayoutWidth(), 0.0f);
|
||||
assertEquals(200f, root_child1.getLayoutHeight(), 0.0f);
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<c3d09a05acce5dcadfa7be4f1618ec5c>>
|
||||
* @generated SignedSource<<a74026bab03aecc7776f5dbb34f233a1>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAlignContentTest.html
|
||||
*/
|
||||
|
||||
@@ -1850,6 +1850,103 @@ test('align_content_space_between_wrapped_negative_space', () => {
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test('align_content_space_between_wrapped_negative_space_row_reverse', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setBorder(Edge.Left, 60);
|
||||
root.setBorder(Edge.Top, 60);
|
||||
root.setBorder(Edge.Right, 60);
|
||||
root.setBorder(Edge.Bottom, 60);
|
||||
root.setWidth(320);
|
||||
root.setHeight(320);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setFlexDirection(FlexDirection.RowReverse);
|
||||
root_child0.setJustifyContent(Justify.Center);
|
||||
root_child0.setAlignContent(Align.SpaceBetween);
|
||||
root_child0.setFlexWrap(Wrap.Wrap);
|
||||
root_child0.setHeight(10);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child0_child0 = Yoga.Node.create(config);
|
||||
root_child0_child0.setWidth("80%");
|
||||
root_child0_child0.setHeight(20);
|
||||
root_child0.insertChild(root_child0_child0, 0);
|
||||
|
||||
const root_child0_child1 = Yoga.Node.create(config);
|
||||
root_child0_child1.setWidth("80%");
|
||||
root_child0_child1.setHeight(20);
|
||||
root_child0.insertChild(root_child0_child1, 1);
|
||||
|
||||
const root_child0_child2 = Yoga.Node.create(config);
|
||||
root_child0_child2.setWidth("80%");
|
||||
root_child0_child2.setHeight(20);
|
||||
root_child0.insertChild(root_child0_child2, 2);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(320);
|
||||
expect(root.getComputedHeight()).toBe(320);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(60);
|
||||
expect(root_child0.getComputedTop()).toBe(60);
|
||||
expect(root_child0.getComputedWidth()).toBe(200);
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
expect(root_child0_child0.getComputedLeft()).toBe(20);
|
||||
expect(root_child0_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(160);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(20);
|
||||
|
||||
expect(root_child0_child1.getComputedLeft()).toBe(20);
|
||||
expect(root_child0_child1.getComputedTop()).toBe(20);
|
||||
expect(root_child0_child1.getComputedWidth()).toBe(160);
|
||||
expect(root_child0_child1.getComputedHeight()).toBe(20);
|
||||
|
||||
expect(root_child0_child2.getComputedLeft()).toBe(20);
|
||||
expect(root_child0_child2.getComputedTop()).toBe(40);
|
||||
expect(root_child0_child2.getComputedWidth()).toBe(160);
|
||||
expect(root_child0_child2.getComputedHeight()).toBe(20);
|
||||
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(320);
|
||||
expect(root.getComputedHeight()).toBe(320);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(60);
|
||||
expect(root_child0.getComputedTop()).toBe(60);
|
||||
expect(root_child0.getComputedWidth()).toBe(200);
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
expect(root_child0_child0.getComputedLeft()).toBe(20);
|
||||
expect(root_child0_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(160);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(20);
|
||||
|
||||
expect(root_child0_child1.getComputedLeft()).toBe(20);
|
||||
expect(root_child0_child1.getComputedTop()).toBe(20);
|
||||
expect(root_child0_child1.getComputedWidth()).toBe(160);
|
||||
expect(root_child0_child1.getComputedHeight()).toBe(20);
|
||||
|
||||
expect(root_child0_child2.getComputedLeft()).toBe(20);
|
||||
expect(root_child0_child2.getComputedTop()).toBe(40);
|
||||
expect(root_child0_child2.getComputedWidth()).toBe(160);
|
||||
expect(root_child0_child2.getComputedHeight()).toBe(20);
|
||||
} finally {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test('align_content_space_between_wrapped_negative_space_gap', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
@@ -2231,17 +2328,17 @@ test('align_content_space_around_wrapped_negative_space', () => {
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
expect(root_child0_child0.getComputedLeft()).toBe(20);
|
||||
expect(root_child0_child0.getComputedTop()).toBe(-25);
|
||||
expect(root_child0_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(160);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(20);
|
||||
|
||||
expect(root_child0_child1.getComputedLeft()).toBe(20);
|
||||
expect(root_child0_child1.getComputedTop()).toBe(-5);
|
||||
expect(root_child0_child1.getComputedTop()).toBe(20);
|
||||
expect(root_child0_child1.getComputedWidth()).toBe(160);
|
||||
expect(root_child0_child1.getComputedHeight()).toBe(20);
|
||||
|
||||
expect(root_child0_child2.getComputedLeft()).toBe(20);
|
||||
expect(root_child0_child2.getComputedTop()).toBe(15);
|
||||
expect(root_child0_child2.getComputedTop()).toBe(40);
|
||||
expect(root_child0_child2.getComputedWidth()).toBe(160);
|
||||
expect(root_child0_child2.getComputedHeight()).toBe(20);
|
||||
|
||||
@@ -2258,17 +2355,114 @@ test('align_content_space_around_wrapped_negative_space', () => {
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
expect(root_child0_child0.getComputedLeft()).toBe(20);
|
||||
expect(root_child0_child0.getComputedTop()).toBe(-25);
|
||||
expect(root_child0_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(160);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(20);
|
||||
|
||||
expect(root_child0_child1.getComputedLeft()).toBe(20);
|
||||
expect(root_child0_child1.getComputedTop()).toBe(-5);
|
||||
expect(root_child0_child1.getComputedTop()).toBe(20);
|
||||
expect(root_child0_child1.getComputedWidth()).toBe(160);
|
||||
expect(root_child0_child1.getComputedHeight()).toBe(20);
|
||||
|
||||
expect(root_child0_child2.getComputedLeft()).toBe(20);
|
||||
expect(root_child0_child2.getComputedTop()).toBe(15);
|
||||
expect(root_child0_child2.getComputedTop()).toBe(40);
|
||||
expect(root_child0_child2.getComputedWidth()).toBe(160);
|
||||
expect(root_child0_child2.getComputedHeight()).toBe(20);
|
||||
} finally {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test('align_content_space_around_wrapped_negative_space_row_reverse', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setBorder(Edge.Left, 60);
|
||||
root.setBorder(Edge.Top, 60);
|
||||
root.setBorder(Edge.Right, 60);
|
||||
root.setBorder(Edge.Bottom, 60);
|
||||
root.setWidth(320);
|
||||
root.setHeight(320);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setFlexDirection(FlexDirection.RowReverse);
|
||||
root_child0.setJustifyContent(Justify.Center);
|
||||
root_child0.setAlignContent(Align.SpaceAround);
|
||||
root_child0.setFlexWrap(Wrap.Wrap);
|
||||
root_child0.setHeight(10);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
const root_child0_child0 = Yoga.Node.create(config);
|
||||
root_child0_child0.setWidth("80%");
|
||||
root_child0_child0.setHeight(20);
|
||||
root_child0.insertChild(root_child0_child0, 0);
|
||||
|
||||
const root_child0_child1 = Yoga.Node.create(config);
|
||||
root_child0_child1.setWidth("80%");
|
||||
root_child0_child1.setHeight(20);
|
||||
root_child0.insertChild(root_child0_child1, 1);
|
||||
|
||||
const root_child0_child2 = Yoga.Node.create(config);
|
||||
root_child0_child2.setWidth("80%");
|
||||
root_child0_child2.setHeight(20);
|
||||
root_child0.insertChild(root_child0_child2, 2);
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(320);
|
||||
expect(root.getComputedHeight()).toBe(320);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(60);
|
||||
expect(root_child0.getComputedTop()).toBe(60);
|
||||
expect(root_child0.getComputedWidth()).toBe(200);
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
expect(root_child0_child0.getComputedLeft()).toBe(20);
|
||||
expect(root_child0_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(160);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(20);
|
||||
|
||||
expect(root_child0_child1.getComputedLeft()).toBe(20);
|
||||
expect(root_child0_child1.getComputedTop()).toBe(20);
|
||||
expect(root_child0_child1.getComputedWidth()).toBe(160);
|
||||
expect(root_child0_child1.getComputedHeight()).toBe(20);
|
||||
|
||||
expect(root_child0_child2.getComputedLeft()).toBe(20);
|
||||
expect(root_child0_child2.getComputedTop()).toBe(40);
|
||||
expect(root_child0_child2.getComputedWidth()).toBe(160);
|
||||
expect(root_child0_child2.getComputedHeight()).toBe(20);
|
||||
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(320);
|
||||
expect(root.getComputedHeight()).toBe(320);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(60);
|
||||
expect(root_child0.getComputedTop()).toBe(60);
|
||||
expect(root_child0.getComputedWidth()).toBe(200);
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
expect(root_child0_child0.getComputedLeft()).toBe(20);
|
||||
expect(root_child0_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(160);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(20);
|
||||
|
||||
expect(root_child0_child1.getComputedLeft()).toBe(20);
|
||||
expect(root_child0_child1.getComputedTop()).toBe(20);
|
||||
expect(root_child0_child1.getComputedWidth()).toBe(160);
|
||||
expect(root_child0_child1.getComputedHeight()).toBe(20);
|
||||
|
||||
expect(root_child0_child2.getComputedLeft()).toBe(20);
|
||||
expect(root_child0_child2.getComputedTop()).toBe(40);
|
||||
expect(root_child0_child2.getComputedWidth()).toBe(160);
|
||||
expect(root_child0_child2.getComputedHeight()).toBe(20);
|
||||
} finally {
|
||||
@@ -2330,17 +2524,17 @@ test('align_content_space_around_wrapped_negative_space_gap', () => {
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
expect(root_child0_child0.getComputedLeft()).toBe(20);
|
||||
expect(root_child0_child0.getComputedTop()).toBe(-35);
|
||||
expect(root_child0_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(160);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(20);
|
||||
|
||||
expect(root_child0_child1.getComputedLeft()).toBe(20);
|
||||
expect(root_child0_child1.getComputedTop()).toBe(-5);
|
||||
expect(root_child0_child1.getComputedTop()).toBe(30);
|
||||
expect(root_child0_child1.getComputedWidth()).toBe(160);
|
||||
expect(root_child0_child1.getComputedHeight()).toBe(20);
|
||||
|
||||
expect(root_child0_child2.getComputedLeft()).toBe(20);
|
||||
expect(root_child0_child2.getComputedTop()).toBe(25);
|
||||
expect(root_child0_child2.getComputedTop()).toBe(60);
|
||||
expect(root_child0_child2.getComputedWidth()).toBe(160);
|
||||
expect(root_child0_child2.getComputedHeight()).toBe(20);
|
||||
|
||||
@@ -2357,17 +2551,17 @@ test('align_content_space_around_wrapped_negative_space_gap', () => {
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
expect(root_child0_child0.getComputedLeft()).toBe(20);
|
||||
expect(root_child0_child0.getComputedTop()).toBe(-35);
|
||||
expect(root_child0_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(160);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(20);
|
||||
|
||||
expect(root_child0_child1.getComputedLeft()).toBe(20);
|
||||
expect(root_child0_child1.getComputedTop()).toBe(-5);
|
||||
expect(root_child0_child1.getComputedTop()).toBe(30);
|
||||
expect(root_child0_child1.getComputedWidth()).toBe(160);
|
||||
expect(root_child0_child1.getComputedHeight()).toBe(20);
|
||||
|
||||
expect(root_child0_child2.getComputedLeft()).toBe(20);
|
||||
expect(root_child0_child2.getComputedTop()).toBe(25);
|
||||
expect(root_child0_child2.getComputedTop()).toBe(60);
|
||||
expect(root_child0_child2.getComputedWidth()).toBe(160);
|
||||
expect(root_child0_child2.getComputedHeight()).toBe(20);
|
||||
} finally {
|
||||
@@ -2660,17 +2854,17 @@ test('align_content_space_evenly_wrapped_negative_space', () => {
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
expect(root_child0_child0.getComputedLeft()).toBe(20);
|
||||
expect(root_child0_child0.getComputedTop()).toBe(-25);
|
||||
expect(root_child0_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(160);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(20);
|
||||
|
||||
expect(root_child0_child1.getComputedLeft()).toBe(20);
|
||||
expect(root_child0_child1.getComputedTop()).toBe(-5);
|
||||
expect(root_child0_child1.getComputedTop()).toBe(20);
|
||||
expect(root_child0_child1.getComputedWidth()).toBe(160);
|
||||
expect(root_child0_child1.getComputedHeight()).toBe(20);
|
||||
|
||||
expect(root_child0_child2.getComputedLeft()).toBe(20);
|
||||
expect(root_child0_child2.getComputedTop()).toBe(15);
|
||||
expect(root_child0_child2.getComputedTop()).toBe(40);
|
||||
expect(root_child0_child2.getComputedWidth()).toBe(160);
|
||||
expect(root_child0_child2.getComputedHeight()).toBe(20);
|
||||
|
||||
@@ -2687,17 +2881,17 @@ test('align_content_space_evenly_wrapped_negative_space', () => {
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
expect(root_child0_child0.getComputedLeft()).toBe(20);
|
||||
expect(root_child0_child0.getComputedTop()).toBe(-25);
|
||||
expect(root_child0_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(160);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(20);
|
||||
|
||||
expect(root_child0_child1.getComputedLeft()).toBe(20);
|
||||
expect(root_child0_child1.getComputedTop()).toBe(-5);
|
||||
expect(root_child0_child1.getComputedTop()).toBe(20);
|
||||
expect(root_child0_child1.getComputedWidth()).toBe(160);
|
||||
expect(root_child0_child1.getComputedHeight()).toBe(20);
|
||||
|
||||
expect(root_child0_child2.getComputedLeft()).toBe(20);
|
||||
expect(root_child0_child2.getComputedTop()).toBe(15);
|
||||
expect(root_child0_child2.getComputedTop()).toBe(40);
|
||||
expect(root_child0_child2.getComputedWidth()).toBe(160);
|
||||
expect(root_child0_child2.getComputedHeight()).toBe(20);
|
||||
} finally {
|
||||
@@ -2759,17 +2953,17 @@ test('align_content_space_evenly_wrapped_negative_space_gap', () => {
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
expect(root_child0_child0.getComputedLeft()).toBe(20);
|
||||
expect(root_child0_child0.getComputedTop()).toBe(-35);
|
||||
expect(root_child0_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(160);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(20);
|
||||
|
||||
expect(root_child0_child1.getComputedLeft()).toBe(20);
|
||||
expect(root_child0_child1.getComputedTop()).toBe(-5);
|
||||
expect(root_child0_child1.getComputedTop()).toBe(30);
|
||||
expect(root_child0_child1.getComputedWidth()).toBe(160);
|
||||
expect(root_child0_child1.getComputedHeight()).toBe(20);
|
||||
|
||||
expect(root_child0_child2.getComputedLeft()).toBe(20);
|
||||
expect(root_child0_child2.getComputedTop()).toBe(25);
|
||||
expect(root_child0_child2.getComputedTop()).toBe(60);
|
||||
expect(root_child0_child2.getComputedWidth()).toBe(160);
|
||||
expect(root_child0_child2.getComputedHeight()).toBe(20);
|
||||
|
||||
@@ -2786,17 +2980,17 @@ test('align_content_space_evenly_wrapped_negative_space_gap', () => {
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
expect(root_child0_child0.getComputedLeft()).toBe(20);
|
||||
expect(root_child0_child0.getComputedTop()).toBe(-35);
|
||||
expect(root_child0_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0_child0.getComputedWidth()).toBe(160);
|
||||
expect(root_child0_child0.getComputedHeight()).toBe(20);
|
||||
|
||||
expect(root_child0_child1.getComputedLeft()).toBe(20);
|
||||
expect(root_child0_child1.getComputedTop()).toBe(-5);
|
||||
expect(root_child0_child1.getComputedTop()).toBe(30);
|
||||
expect(root_child0_child1.getComputedWidth()).toBe(160);
|
||||
expect(root_child0_child1.getComputedHeight()).toBe(20);
|
||||
|
||||
expect(root_child0_child2.getComputedLeft()).toBe(20);
|
||||
expect(root_child0_child2.getComputedTop()).toBe(25);
|
||||
expect(root_child0_child2.getComputedTop()).toBe(60);
|
||||
expect(root_child0_child2.getComputedWidth()).toBe(160);
|
||||
expect(root_child0_child2.getComputedHeight()).toBe(20);
|
||||
} finally {
|
||||
@@ -4480,12 +4674,12 @@ test('align_content_space_evenly_with_max_cross_axis_violated', () => {
|
||||
expect(root.getComputedHeight()).toBe(300);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0.getComputedTop()).toBe(-50);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(400);
|
||||
expect(root_child0.getComputedHeight()).toBe(200);
|
||||
|
||||
expect(root_child1.getComputedLeft()).toBe(0);
|
||||
expect(root_child1.getComputedTop()).toBe(150);
|
||||
expect(root_child1.getComputedTop()).toBe(200);
|
||||
expect(root_child1.getComputedWidth()).toBe(400);
|
||||
expect(root_child1.getComputedHeight()).toBe(200);
|
||||
|
||||
@@ -4497,12 +4691,12 @@ test('align_content_space_evenly_with_max_cross_axis_violated', () => {
|
||||
expect(root.getComputedHeight()).toBe(300);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(100);
|
||||
expect(root_child0.getComputedTop()).toBe(-50);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(400);
|
||||
expect(root_child0.getComputedHeight()).toBe(200);
|
||||
|
||||
expect(root_child1.getComputedLeft()).toBe(100);
|
||||
expect(root_child1.getComputedTop()).toBe(150);
|
||||
expect(root_child1.getComputedTop()).toBe(200);
|
||||
expect(root_child1.getComputedWidth()).toBe(400);
|
||||
expect(root_child1.getComputedHeight()).toBe(200);
|
||||
} finally {
|
||||
@@ -4551,12 +4745,12 @@ test('align_content_space_evenly_with_max_cross_axis_violated_padding_and_border
|
||||
expect(root.getComputedHeight()).toBe(300);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(7);
|
||||
expect(root_child0.getComputedTop()).toBe(-50);
|
||||
expect(root_child0.getComputedTop()).toBe(7);
|
||||
expect(root_child0.getComputedWidth()).toBe(400);
|
||||
expect(root_child0.getComputedHeight()).toBe(200);
|
||||
|
||||
expect(root_child1.getComputedLeft()).toBe(7);
|
||||
expect(root_child1.getComputedTop()).toBe(150);
|
||||
expect(root_child1.getComputedTop()).toBe(207);
|
||||
expect(root_child1.getComputedWidth()).toBe(400);
|
||||
expect(root_child1.getComputedHeight()).toBe(200);
|
||||
|
||||
@@ -4568,12 +4762,12 @@ test('align_content_space_evenly_with_max_cross_axis_violated_padding_and_border
|
||||
expect(root.getComputedHeight()).toBe(300);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(93);
|
||||
expect(root_child0.getComputedTop()).toBe(-50);
|
||||
expect(root_child0.getComputedTop()).toBe(7);
|
||||
expect(root_child0.getComputedWidth()).toBe(400);
|
||||
expect(root_child0.getComputedHeight()).toBe(200);
|
||||
|
||||
expect(root_child1.getComputedLeft()).toBe(93);
|
||||
expect(root_child1.getComputedTop()).toBe(150);
|
||||
expect(root_child1.getComputedTop()).toBe(207);
|
||||
expect(root_child1.getComputedWidth()).toBe(400);
|
||||
expect(root_child1.getComputedHeight()).toBe(200);
|
||||
} finally {
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* clang-format off
|
||||
* @generated SignedSource<<00c7c9f10d513c97b4c00c9d52e52400>>
|
||||
* @generated SignedSource<<460f0841a9a42c1bfab47b91c2acfe31>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAlignContentTest.html
|
||||
*/
|
||||
|
||||
@@ -1752,6 +1752,99 @@ TEST(YogaTest, align_content_space_between_wrapped_negative_space) {
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, align_content_space_between_wrapped_negative_space_row_reverse) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||
YGNodeStyleSetBorder(root, YGEdgeLeft, 60);
|
||||
YGNodeStyleSetBorder(root, YGEdgeTop, 60);
|
||||
YGNodeStyleSetBorder(root, YGEdgeRight, 60);
|
||||
YGNodeStyleSetBorder(root, YGEdgeBottom, 60);
|
||||
YGNodeStyleSetWidth(root, 320);
|
||||
YGNodeStyleSetHeight(root, 320);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRowReverse);
|
||||
YGNodeStyleSetJustifyContent(root_child0, YGJustifyCenter);
|
||||
YGNodeStyleSetAlignContent(root_child0, YGAlignSpaceBetween);
|
||||
YGNodeStyleSetFlexWrap(root_child0, YGWrapWrap);
|
||||
YGNodeStyleSetHeight(root_child0, 10);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidthPercent(root_child0_child0, 80);
|
||||
YGNodeStyleSetHeight(root_child0_child0, 20);
|
||||
YGNodeInsertChild(root_child0, root_child0_child0, 0);
|
||||
|
||||
const YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidthPercent(root_child0_child1, 80);
|
||||
YGNodeStyleSetHeight(root_child0_child1, 20);
|
||||
YGNodeInsertChild(root_child0, root_child0_child1, 1);
|
||||
|
||||
const YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidthPercent(root_child0_child2, 80);
|
||||
YGNodeStyleSetHeight(root_child0_child2, 20);
|
||||
YGNodeInsertChild(root_child0, root_child0_child2, 2);
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||
ASSERT_FLOAT_EQ(320, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(320, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(160, YGNodeLayoutGetWidth(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(160, YGNodeLayoutGetWidth(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child1));
|
||||
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(160, YGNodeLayoutGetWidth(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child2));
|
||||
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||
ASSERT_FLOAT_EQ(320, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(320, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(160, YGNodeLayoutGetWidth(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(160, YGNodeLayoutGetWidth(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child1));
|
||||
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(160, YGNodeLayoutGetWidth(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child2));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, align_content_space_between_wrapped_negative_space_gap) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
@@ -2115,17 +2208,17 @@ TEST(YogaTest, align_content_space_around_wrapped_negative_space) {
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(-25, YGNodeLayoutGetTop(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(160, YGNodeLayoutGetWidth(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(-5, YGNodeLayoutGetTop(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(160, YGNodeLayoutGetWidth(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child1));
|
||||
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(15, YGNodeLayoutGetTop(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(160, YGNodeLayoutGetWidth(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child2));
|
||||
|
||||
@@ -2142,17 +2235,110 @@ TEST(YogaTest, align_content_space_around_wrapped_negative_space) {
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(-25, YGNodeLayoutGetTop(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(160, YGNodeLayoutGetWidth(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(-5, YGNodeLayoutGetTop(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(160, YGNodeLayoutGetWidth(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child1));
|
||||
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(15, YGNodeLayoutGetTop(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(160, YGNodeLayoutGetWidth(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child2));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, align_content_space_around_wrapped_negative_space_row_reverse) {
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||
YGNodeStyleSetBorder(root, YGEdgeLeft, 60);
|
||||
YGNodeStyleSetBorder(root, YGEdgeTop, 60);
|
||||
YGNodeStyleSetBorder(root, YGEdgeRight, 60);
|
||||
YGNodeStyleSetBorder(root, YGEdgeBottom, 60);
|
||||
YGNodeStyleSetWidth(root, 320);
|
||||
YGNodeStyleSetHeight(root, 320);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRowReverse);
|
||||
YGNodeStyleSetJustifyContent(root_child0, YGJustifyCenter);
|
||||
YGNodeStyleSetAlignContent(root_child0, YGAlignSpaceAround);
|
||||
YGNodeStyleSetFlexWrap(root_child0, YGWrapWrap);
|
||||
YGNodeStyleSetHeight(root_child0, 10);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidthPercent(root_child0_child0, 80);
|
||||
YGNodeStyleSetHeight(root_child0_child0, 20);
|
||||
YGNodeInsertChild(root_child0, root_child0_child0, 0);
|
||||
|
||||
const YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidthPercent(root_child0_child1, 80);
|
||||
YGNodeStyleSetHeight(root_child0_child1, 20);
|
||||
YGNodeInsertChild(root_child0, root_child0_child1, 1);
|
||||
|
||||
const YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidthPercent(root_child0_child2, 80);
|
||||
YGNodeStyleSetHeight(root_child0_child2, 20);
|
||||
YGNodeInsertChild(root_child0, root_child0_child2, 2);
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||
ASSERT_FLOAT_EQ(320, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(320, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(160, YGNodeLayoutGetWidth(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(160, YGNodeLayoutGetWidth(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child1));
|
||||
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(160, YGNodeLayoutGetWidth(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child2));
|
||||
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||
ASSERT_FLOAT_EQ(320, YGNodeLayoutGetWidth(root));
|
||||
ASSERT_FLOAT_EQ(320, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(160, YGNodeLayoutGetWidth(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(160, YGNodeLayoutGetWidth(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child1));
|
||||
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(160, YGNodeLayoutGetWidth(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child2));
|
||||
|
||||
@@ -2210,17 +2396,17 @@ TEST(YogaTest, align_content_space_around_wrapped_negative_space_gap) {
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(-35, YGNodeLayoutGetTop(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(160, YGNodeLayoutGetWidth(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(-5, YGNodeLayoutGetTop(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetTop(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(160, YGNodeLayoutGetWidth(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child1));
|
||||
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(25, YGNodeLayoutGetTop(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetTop(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(160, YGNodeLayoutGetWidth(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child2));
|
||||
|
||||
@@ -2237,17 +2423,17 @@ TEST(YogaTest, align_content_space_around_wrapped_negative_space_gap) {
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(-35, YGNodeLayoutGetTop(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(160, YGNodeLayoutGetWidth(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(-5, YGNodeLayoutGetTop(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetTop(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(160, YGNodeLayoutGetWidth(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child1));
|
||||
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(25, YGNodeLayoutGetTop(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetTop(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(160, YGNodeLayoutGetWidth(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child2));
|
||||
|
||||
@@ -2524,17 +2710,17 @@ TEST(YogaTest, align_content_space_evenly_wrapped_negative_space) {
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(-25, YGNodeLayoutGetTop(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(160, YGNodeLayoutGetWidth(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(-5, YGNodeLayoutGetTop(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(160, YGNodeLayoutGetWidth(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child1));
|
||||
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(15, YGNodeLayoutGetTop(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(160, YGNodeLayoutGetWidth(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child2));
|
||||
|
||||
@@ -2551,17 +2737,17 @@ TEST(YogaTest, align_content_space_evenly_wrapped_negative_space) {
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(-25, YGNodeLayoutGetTop(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(160, YGNodeLayoutGetWidth(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(-5, YGNodeLayoutGetTop(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(160, YGNodeLayoutGetWidth(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child1));
|
||||
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(15, YGNodeLayoutGetTop(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(160, YGNodeLayoutGetWidth(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child2));
|
||||
|
||||
@@ -2619,17 +2805,17 @@ TEST(YogaTest, align_content_space_evenly_wrapped_negative_space_gap) {
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(-35, YGNodeLayoutGetTop(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(160, YGNodeLayoutGetWidth(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(-5, YGNodeLayoutGetTop(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetTop(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(160, YGNodeLayoutGetWidth(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child1));
|
||||
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(25, YGNodeLayoutGetTop(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetTop(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(160, YGNodeLayoutGetWidth(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child2));
|
||||
|
||||
@@ -2646,17 +2832,17 @@ TEST(YogaTest, align_content_space_evenly_wrapped_negative_space_gap) {
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(-35, YGNodeLayoutGetTop(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(160, YGNodeLayoutGetWidth(root_child0_child0));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(-5, YGNodeLayoutGetTop(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetTop(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(160, YGNodeLayoutGetWidth(root_child0_child1));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child1));
|
||||
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(25, YGNodeLayoutGetTop(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetTop(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(160, YGNodeLayoutGetWidth(root_child0_child2));
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child2));
|
||||
|
||||
@@ -4264,12 +4450,12 @@ TEST(YogaTest, align_content_space_evenly_with_max_cross_axis_violated) {
|
||||
ASSERT_FLOAT_EQ(300, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(-50, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(200, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root_child1));
|
||||
ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root_child1));
|
||||
|
||||
@@ -4281,12 +4467,12 @@ TEST(YogaTest, align_content_space_evenly_with_max_cross_axis_violated) {
|
||||
ASSERT_FLOAT_EQ(300, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(-50, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(200, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root_child1));
|
||||
ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root_child1));
|
||||
|
||||
@@ -4331,12 +4517,12 @@ TEST(YogaTest, align_content_space_evenly_with_max_cross_axis_violated_padding_a
|
||||
ASSERT_FLOAT_EQ(300, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(7, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(-50, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(7, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(7, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(207, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root_child1));
|
||||
ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root_child1));
|
||||
|
||||
@@ -4348,12 +4534,12 @@ TEST(YogaTest, align_content_space_evenly_with_max_cross_axis_violated_padding_a
|
||||
ASSERT_FLOAT_EQ(300, YGNodeLayoutGetHeight(root));
|
||||
|
||||
ASSERT_FLOAT_EQ(93, YGNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(-50, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(7, YGNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root_child0));
|
||||
ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
ASSERT_FLOAT_EQ(93, YGNodeLayoutGetLeft(root_child1));
|
||||
ASSERT_FLOAT_EQ(150, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(207, YGNodeLayoutGetTop(root_child1));
|
||||
ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root_child1));
|
||||
ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root_child1));
|
||||
|
||||
|
@@ -1745,7 +1745,28 @@ static void calculateLayoutImpl(
|
||||
paddingAndBorderAxisCross;
|
||||
|
||||
const float remainingAlignContentDim = innerCrossDim - totalLineCrossDim;
|
||||
switch (node->style().alignContent()) {
|
||||
|
||||
// Apply fallback alignments on overflow
|
||||
// https://www.w3.org/TR/css-align-3/#distribution-values
|
||||
const auto appliedAlignContent =
|
||||
remainingAlignContentDim >= 0 ? node->style().alignContent() : [&]() {
|
||||
switch (node->style().alignContent()) {
|
||||
// Fallback to flex-start
|
||||
case Align::SpaceBetween:
|
||||
case Align::Stretch:
|
||||
return Align::FlexStart;
|
||||
|
||||
// Fallback to safe center. TODO: This should be aligned to Start
|
||||
// instead of FlexStart (for row-reverse containers)
|
||||
case Align::SpaceAround:
|
||||
case Align::SpaceEvenly:
|
||||
return Align::FlexStart;
|
||||
default:
|
||||
return node->style().alignContent();
|
||||
}
|
||||
}();
|
||||
|
||||
switch (appliedAlignContent) {
|
||||
case Align::FlexEnd:
|
||||
currentLead += remainingAlignContentDim;
|
||||
break;
|
||||
@@ -1753,33 +1774,21 @@ static void calculateLayoutImpl(
|
||||
currentLead += remainingAlignContentDim / 2;
|
||||
break;
|
||||
case Align::Stretch:
|
||||
if (innerCrossDim > totalLineCrossDim) {
|
||||
leadPerLine =
|
||||
remainingAlignContentDim / static_cast<float>(lineCount);
|
||||
}
|
||||
leadPerLine = remainingAlignContentDim / static_cast<float>(lineCount);
|
||||
break;
|
||||
case Align::SpaceAround:
|
||||
if (innerCrossDim > totalLineCrossDim) {
|
||||
currentLead +=
|
||||
remainingAlignContentDim / (2 * static_cast<float>(lineCount));
|
||||
leadPerLine =
|
||||
remainingAlignContentDim / static_cast<float>(lineCount);
|
||||
} else {
|
||||
currentLead += remainingAlignContentDim / 2;
|
||||
}
|
||||
currentLead +=
|
||||
remainingAlignContentDim / (2 * static_cast<float>(lineCount));
|
||||
leadPerLine = remainingAlignContentDim / static_cast<float>(lineCount);
|
||||
break;
|
||||
case Align::SpaceEvenly:
|
||||
if (innerCrossDim > totalLineCrossDim) {
|
||||
currentLead +=
|
||||
remainingAlignContentDim / static_cast<float>(lineCount + 1);
|
||||
leadPerLine =
|
||||
remainingAlignContentDim / static_cast<float>(lineCount + 1);
|
||||
} else {
|
||||
currentLead += remainingAlignContentDim / 2;
|
||||
}
|
||||
currentLead +=
|
||||
remainingAlignContentDim / static_cast<float>(lineCount + 1);
|
||||
leadPerLine =
|
||||
remainingAlignContentDim / static_cast<float>(lineCount + 1);
|
||||
break;
|
||||
case Align::SpaceBetween:
|
||||
if (innerCrossDim > totalLineCrossDim && lineCount > 1) {
|
||||
if (lineCount > 1) {
|
||||
leadPerLine =
|
||||
remainingAlignContentDim / static_cast<float>(lineCount - 1);
|
||||
}
|
||||
|
Reference in New Issue
Block a user