|
| 1 | +/* |
| 2 | + * Copyright (c) Meta Platforms, Inc. and affiliates. |
| 3 | + * |
| 4 | + * This source code is licensed under the MIT license found in the |
| 5 | + * LICENSE file in the root directory of this source tree. |
| 6 | + * |
| 7 | + * @generated SignedSource<<de7cd96816cf100e87f895b2116f7bc6>> |
| 8 | + * generated by gentest/gentest-driver.ts from gentest/fixtures/grid_auto_margin_overflow_inline.html |
| 9 | + */ |
| 10 | + |
| 11 | +package com.facebook.yoga; |
| 12 | + |
| 13 | +import static org.junit.Assert.assertEquals; |
| 14 | + |
| 15 | +import org.junit.Ignore; |
| 16 | +import org.junit.Test; |
| 17 | +import org.junit.runner.RunWith; |
| 18 | +import org.junit.runners.Parameterized; |
| 19 | +import com.facebook.yoga.utils.TestUtils; |
| 20 | + |
| 21 | +@RunWith(Parameterized.class) |
| 22 | +public class grid_auto_margin_overflow_inline { |
| 23 | + @Parameterized.Parameters(name = "{0}") |
| 24 | + public static Iterable<TestParametrization.NodeFactory> nodeFactories() { |
| 25 | + return TestParametrization.nodeFactories(); |
| 26 | + } |
| 27 | + |
| 28 | + @Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory; |
| 29 | + |
| 30 | + @Test |
| 31 | + public void test_grid_auto_margin_overflow_inline() { |
| 32 | + YogaConfig config = YogaConfigFactory.create(); |
| 33 | + |
| 34 | + final YogaNode root = createNode(config); |
| 35 | + root.setPositionType(YogaPositionType.ABSOLUTE); |
| 36 | + root.setWidth(100f); |
| 37 | + root.setDisplay(YogaDisplay.GRID); |
| 38 | + YogaGridTrackList rootGridTemplateColumns = new YogaGridTrackList(); |
| 39 | + rootGridTemplateColumns.addTrack(YogaGridTrackValue.auto()); |
| 40 | + rootGridTemplateColumns.addTrack(YogaGridTrackValue.auto()); |
| 41 | + rootGridTemplateColumns.addTrack(YogaGridTrackValue.auto()); |
| 42 | + rootGridTemplateColumns.addTrack(YogaGridTrackValue.auto()); |
| 43 | + rootGridTemplateColumns.addTrack(YogaGridTrackValue.auto()); |
| 44 | + root.setGridTemplateColumns(rootGridTemplateColumns); |
| 45 | + |
| 46 | + final YogaNode root_child0 = createNode(config); |
| 47 | + root_child0.setMarginAuto(YogaEdge.LEFT); |
| 48 | + root_child0.setMarginAuto(YogaEdge.RIGHT); |
| 49 | + root_child0.setWidth(200f); |
| 50 | + root_child0.setHeight(50f); |
| 51 | + root.addChildAt(root_child0, 0); |
| 52 | + root.setDirection(YogaDirection.LTR); |
| 53 | + root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); |
| 54 | + |
| 55 | + assertEquals(0f, root.getLayoutX(), 0.0f); |
| 56 | + assertEquals(0f, root.getLayoutY(), 0.0f); |
| 57 | + assertEquals(100f, root.getLayoutWidth(), 0.0f); |
| 58 | + assertEquals(50f, root.getLayoutHeight(), 0.0f); |
| 59 | + |
| 60 | + assertEquals(0f, root_child0.getLayoutX(), 0.0f); |
| 61 | + assertEquals(0f, root_child0.getLayoutY(), 0.0f); |
| 62 | + assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); |
| 63 | + assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); |
| 64 | + |
| 65 | + root.setDirection(YogaDirection.RTL); |
| 66 | + root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); |
| 67 | + |
| 68 | + assertEquals(0f, root.getLayoutX(), 0.0f); |
| 69 | + assertEquals(0f, root.getLayoutY(), 0.0f); |
| 70 | + assertEquals(100f, root.getLayoutWidth(), 0.0f); |
| 71 | + assertEquals(50f, root.getLayoutHeight(), 0.0f); |
| 72 | + |
| 73 | + assertEquals(-100f, root_child0.getLayoutX(), 0.0f); |
| 74 | + assertEquals(0f, root_child0.getLayoutY(), 0.0f); |
| 75 | + assertEquals(200f, root_child0.getLayoutWidth(), 0.0f); |
| 76 | + assertEquals(50f, root_child0.getLayoutHeight(), 0.0f); |
| 77 | + } |
| 78 | + |
| 79 | + private YogaNode createNode(YogaConfig config) { |
| 80 | + return mNodeFactory.create(config); |
| 81 | + } |
| 82 | +} |
0 commit comments