|
| 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<<ce9f7f93536e52e63e409874ac2f0fc0>> |
| 8 | + * generated by gentest/gentest-driver.ts from gentest/fixtures/grid_align_content_space_evenly_with_padding_border.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_align_content_space_evenly_with_padding_border { |
| 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_align_content_space_evenly_with_padding_border() { |
| 32 | + YogaConfig config = YogaConfigFactory.create(); |
| 33 | + |
| 34 | + final YogaNode root = createNode(config); |
| 35 | + root.setAlignContent(YogaAlign.SPACE_EVENLY); |
| 36 | + root.setPositionType(YogaPositionType.ABSOLUTE); |
| 37 | + root.setPadding(YogaEdge.LEFT, 40); |
| 38 | + root.setPadding(YogaEdge.TOP, 10); |
| 39 | + root.setPadding(YogaEdge.RIGHT, 20); |
| 40 | + root.setPadding(YogaEdge.BOTTOM, 30); |
| 41 | + root.setBorder(YogaEdge.LEFT, 8f); |
| 42 | + root.setBorder(YogaEdge.TOP, 2f); |
| 43 | + root.setBorder(YogaEdge.RIGHT, 4f); |
| 44 | + root.setBorder(YogaEdge.BOTTOM, 6f); |
| 45 | + root.setWidth(200f); |
| 46 | + root.setHeight(200f); |
| 47 | + root.setDisplay(YogaDisplay.GRID); |
| 48 | + YogaGridTrackList rootGridTemplateColumns = new YogaGridTrackList(); |
| 49 | + rootGridTemplateColumns.addTrack(YogaGridTrackValue.auto()); |
| 50 | + rootGridTemplateColumns.addTrack(YogaGridTrackValue.auto()); |
| 51 | + rootGridTemplateColumns.addTrack(YogaGridTrackValue.auto()); |
| 52 | + rootGridTemplateColumns.addTrack(YogaGridTrackValue.auto()); |
| 53 | + rootGridTemplateColumns.addTrack(YogaGridTrackValue.auto()); |
| 54 | + rootGridTemplateColumns.addTrack(YogaGridTrackValue.auto()); |
| 55 | + rootGridTemplateColumns.addTrack(YogaGridTrackValue.auto()); |
| 56 | + rootGridTemplateColumns.addTrack(YogaGridTrackValue.auto()); |
| 57 | + rootGridTemplateColumns.addTrack(YogaGridTrackValue.auto()); |
| 58 | + rootGridTemplateColumns.addTrack(YogaGridTrackValue.auto()); |
| 59 | + rootGridTemplateColumns.addTrack(YogaGridTrackValue.auto()); |
| 60 | + rootGridTemplateColumns.addTrack(YogaGridTrackValue.auto()); |
| 61 | + rootGridTemplateColumns.addTrack(YogaGridTrackValue.auto()); |
| 62 | + rootGridTemplateColumns.addTrack(YogaGridTrackValue.auto()); |
| 63 | + root.setGridTemplateColumns(rootGridTemplateColumns); |
| 64 | + YogaGridTrackList rootGridTemplateRows = new YogaGridTrackList(); |
| 65 | + rootGridTemplateRows.addTrack(YogaGridTrackValue.auto()); |
| 66 | + rootGridTemplateRows.addTrack(YogaGridTrackValue.auto()); |
| 67 | + rootGridTemplateRows.addTrack(YogaGridTrackValue.auto()); |
| 68 | + rootGridTemplateRows.addTrack(YogaGridTrackValue.auto()); |
| 69 | + rootGridTemplateRows.addTrack(YogaGridTrackValue.auto()); |
| 70 | + rootGridTemplateRows.addTrack(YogaGridTrackValue.auto()); |
| 71 | + rootGridTemplateRows.addTrack(YogaGridTrackValue.auto()); |
| 72 | + rootGridTemplateRows.addTrack(YogaGridTrackValue.auto()); |
| 73 | + rootGridTemplateRows.addTrack(YogaGridTrackValue.auto()); |
| 74 | + rootGridTemplateRows.addTrack(YogaGridTrackValue.auto()); |
| 75 | + rootGridTemplateRows.addTrack(YogaGridTrackValue.auto()); |
| 76 | + rootGridTemplateRows.addTrack(YogaGridTrackValue.auto()); |
| 77 | + rootGridTemplateRows.addTrack(YogaGridTrackValue.auto()); |
| 78 | + rootGridTemplateRows.addTrack(YogaGridTrackValue.auto()); |
| 79 | + root.setGridTemplateRows(rootGridTemplateRows); |
| 80 | + |
| 81 | + final YogaNode root_child0 = createNode(config); |
| 82 | + root.addChildAt(root_child0, 0); |
| 83 | + |
| 84 | + final YogaNode root_child1 = createNode(config); |
| 85 | + root.addChildAt(root_child1, 1); |
| 86 | + |
| 87 | + final YogaNode root_child2 = createNode(config); |
| 88 | + root.addChildAt(root_child2, 2); |
| 89 | + |
| 90 | + final YogaNode root_child3 = createNode(config); |
| 91 | + root.addChildAt(root_child3, 3); |
| 92 | + |
| 93 | + final YogaNode root_child4 = createNode(config); |
| 94 | + root.addChildAt(root_child4, 4); |
| 95 | + |
| 96 | + final YogaNode root_child5 = createNode(config); |
| 97 | + root.addChildAt(root_child5, 5); |
| 98 | + |
| 99 | + final YogaNode root_child6 = createNode(config); |
| 100 | + root.addChildAt(root_child6, 6); |
| 101 | + |
| 102 | + final YogaNode root_child7 = createNode(config); |
| 103 | + root.addChildAt(root_child7, 7); |
| 104 | + |
| 105 | + final YogaNode root_child8 = createNode(config); |
| 106 | + root.addChildAt(root_child8, 8); |
| 107 | + root.setDirection(YogaDirection.LTR); |
| 108 | + root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); |
| 109 | + |
| 110 | + assertEquals(0f, root.getLayoutX(), 0.0f); |
| 111 | + assertEquals(0f, root.getLayoutY(), 0.0f); |
| 112 | + assertEquals(200f, root.getLayoutWidth(), 0.0f); |
| 113 | + assertEquals(200f, root.getLayoutHeight(), 0.0f); |
| 114 | + |
| 115 | + assertEquals(48f, root_child0.getLayoutX(), 0.0f); |
| 116 | + assertEquals(20f, root_child0.getLayoutY(), 0.0f); |
| 117 | + assertEquals(40f, root_child0.getLayoutWidth(), 0.0f); |
| 118 | + assertEquals(40f, root_child0.getLayoutHeight(), 0.0f); |
| 119 | + |
| 120 | + assertEquals(88f, root_child1.getLayoutX(), 0.0f); |
| 121 | + assertEquals(20f, root_child1.getLayoutY(), 0.0f); |
| 122 | + assertEquals(40f, root_child1.getLayoutWidth(), 0.0f); |
| 123 | + assertEquals(40f, root_child1.getLayoutHeight(), 0.0f); |
| 124 | + |
| 125 | + assertEquals(128f, root_child2.getLayoutX(), 0.0f); |
| 126 | + assertEquals(20f, root_child2.getLayoutY(), 0.0f); |
| 127 | + assertEquals(40f, root_child2.getLayoutWidth(), 0.0f); |
| 128 | + assertEquals(40f, root_child2.getLayoutHeight(), 0.0f); |
| 129 | + |
| 130 | + assertEquals(48f, root_child3.getLayoutX(), 0.0f); |
| 131 | + assertEquals(68f, root_child3.getLayoutY(), 0.0f); |
| 132 | + assertEquals(40f, root_child3.getLayoutWidth(), 0.0f); |
| 133 | + assertEquals(40f, root_child3.getLayoutHeight(), 0.0f); |
| 134 | + |
| 135 | + assertEquals(88f, root_child4.getLayoutX(), 0.0f); |
| 136 | + assertEquals(68f, root_child4.getLayoutY(), 0.0f); |
| 137 | + assertEquals(40f, root_child4.getLayoutWidth(), 0.0f); |
| 138 | + assertEquals(40f, root_child4.getLayoutHeight(), 0.0f); |
| 139 | + |
| 140 | + assertEquals(128f, root_child5.getLayoutX(), 0.0f); |
| 141 | + assertEquals(68f, root_child5.getLayoutY(), 0.0f); |
| 142 | + assertEquals(40f, root_child5.getLayoutWidth(), 0.0f); |
| 143 | + assertEquals(40f, root_child5.getLayoutHeight(), 0.0f); |
| 144 | + |
| 145 | + assertEquals(48f, root_child6.getLayoutX(), 0.0f); |
| 146 | + assertEquals(116f, root_child6.getLayoutY(), 0.0f); |
| 147 | + assertEquals(40f, root_child6.getLayoutWidth(), 0.0f); |
| 148 | + assertEquals(40f, root_child6.getLayoutHeight(), 0.0f); |
| 149 | + |
| 150 | + assertEquals(88f, root_child7.getLayoutX(), 0.0f); |
| 151 | + assertEquals(116f, root_child7.getLayoutY(), 0.0f); |
| 152 | + assertEquals(40f, root_child7.getLayoutWidth(), 0.0f); |
| 153 | + assertEquals(40f, root_child7.getLayoutHeight(), 0.0f); |
| 154 | + |
| 155 | + assertEquals(128f, root_child8.getLayoutX(), 0.0f); |
| 156 | + assertEquals(116f, root_child8.getLayoutY(), 0.0f); |
| 157 | + assertEquals(40f, root_child8.getLayoutWidth(), 0.0f); |
| 158 | + assertEquals(40f, root_child8.getLayoutHeight(), 0.0f); |
| 159 | + |
| 160 | + root.setDirection(YogaDirection.RTL); |
| 161 | + root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED); |
| 162 | + |
| 163 | + assertEquals(0f, root.getLayoutX(), 0.0f); |
| 164 | + assertEquals(0f, root.getLayoutY(), 0.0f); |
| 165 | + assertEquals(200f, root.getLayoutWidth(), 0.0f); |
| 166 | + assertEquals(200f, root.getLayoutHeight(), 0.0f); |
| 167 | + |
| 168 | + assertEquals(136f, root_child0.getLayoutX(), 0.0f); |
| 169 | + assertEquals(20f, root_child0.getLayoutY(), 0.0f); |
| 170 | + assertEquals(40f, root_child0.getLayoutWidth(), 0.0f); |
| 171 | + assertEquals(40f, root_child0.getLayoutHeight(), 0.0f); |
| 172 | + |
| 173 | + assertEquals(96f, root_child1.getLayoutX(), 0.0f); |
| 174 | + assertEquals(20f, root_child1.getLayoutY(), 0.0f); |
| 175 | + assertEquals(40f, root_child1.getLayoutWidth(), 0.0f); |
| 176 | + assertEquals(40f, root_child1.getLayoutHeight(), 0.0f); |
| 177 | + |
| 178 | + assertEquals(56f, root_child2.getLayoutX(), 0.0f); |
| 179 | + assertEquals(20f, root_child2.getLayoutY(), 0.0f); |
| 180 | + assertEquals(40f, root_child2.getLayoutWidth(), 0.0f); |
| 181 | + assertEquals(40f, root_child2.getLayoutHeight(), 0.0f); |
| 182 | + |
| 183 | + assertEquals(136f, root_child3.getLayoutX(), 0.0f); |
| 184 | + assertEquals(68f, root_child3.getLayoutY(), 0.0f); |
| 185 | + assertEquals(40f, root_child3.getLayoutWidth(), 0.0f); |
| 186 | + assertEquals(40f, root_child3.getLayoutHeight(), 0.0f); |
| 187 | + |
| 188 | + assertEquals(96f, root_child4.getLayoutX(), 0.0f); |
| 189 | + assertEquals(68f, root_child4.getLayoutY(), 0.0f); |
| 190 | + assertEquals(40f, root_child4.getLayoutWidth(), 0.0f); |
| 191 | + assertEquals(40f, root_child4.getLayoutHeight(), 0.0f); |
| 192 | + |
| 193 | + assertEquals(56f, root_child5.getLayoutX(), 0.0f); |
| 194 | + assertEquals(68f, root_child5.getLayoutY(), 0.0f); |
| 195 | + assertEquals(40f, root_child5.getLayoutWidth(), 0.0f); |
| 196 | + assertEquals(40f, root_child5.getLayoutHeight(), 0.0f); |
| 197 | + |
| 198 | + assertEquals(136f, root_child6.getLayoutX(), 0.0f); |
| 199 | + assertEquals(116f, root_child6.getLayoutY(), 0.0f); |
| 200 | + assertEquals(40f, root_child6.getLayoutWidth(), 0.0f); |
| 201 | + assertEquals(40f, root_child6.getLayoutHeight(), 0.0f); |
| 202 | + |
| 203 | + assertEquals(96f, root_child7.getLayoutX(), 0.0f); |
| 204 | + assertEquals(116f, root_child7.getLayoutY(), 0.0f); |
| 205 | + assertEquals(40f, root_child7.getLayoutWidth(), 0.0f); |
| 206 | + assertEquals(40f, root_child7.getLayoutHeight(), 0.0f); |
| 207 | + |
| 208 | + assertEquals(56f, root_child8.getLayoutX(), 0.0f); |
| 209 | + assertEquals(116f, root_child8.getLayoutY(), 0.0f); |
| 210 | + assertEquals(40f, root_child8.getLayoutWidth(), 0.0f); |
| 211 | + assertEquals(40f, root_child8.getLayoutHeight(), 0.0f); |
| 212 | + } |
| 213 | + |
| 214 | + private YogaNode createNode(YogaConfig config) { |
| 215 | + return mNodeFactory.create(config); |
| 216 | + } |
| 217 | +} |
0 commit comments