Add row reverse tests for border
Summary: after looking into the issue described in https://github.com/facebook/yoga/issues/1208 it seems to apply to border too, so adding tests to confirm Reviewed By: NickGerleman Differential Revision: D50153472 fbshipit-source-id: a50f3e040153086b6a573924b513919dbb94f3c0
This commit is contained in:
committed by
Facebook GitHub Bot
parent
9d9b1f0874
commit
799624b9a5
@@ -108,3 +108,39 @@
|
|||||||
<div style="width: 10px;"></div>
|
<div style="width: 10px;"></div>
|
||||||
<div style="width: 10px;"></div>
|
<div style="width: 10px;"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="flex_direction_row_reverse_border_left" style="height: 100px; width: 100px; flex-direction: row-reverse; border-left-width: 100px;">
|
||||||
|
<div style="width: 10px;"></div>
|
||||||
|
<div style="width: 10px;"></div>
|
||||||
|
<div style="width: 10px;"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="flex_direction_row_reverse_border_start" data-disabled="true" style="height: 100px; width: 100px; flex-direction: row-reverse; border-start-width: 100px;">
|
||||||
|
<div style="width: 10px;"></div>
|
||||||
|
<div style="width: 10px;"></div>
|
||||||
|
<div style="width: 10px;"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="flex_direction_row_reverse_border_right" style="height: 100px; width: 100px; flex-direction: row-reverse; border-right-width: 100px;">
|
||||||
|
<div style="width: 10px;"></div>
|
||||||
|
<div style="width: 10px;"></div>
|
||||||
|
<div style="width: 10px;"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="flex_direction_row_reverse_border_end" data-disabled="true" style="height: 100px; width: 100px; flex-direction: row-reverse; border-end-width: 100px;">
|
||||||
|
<div style="width: 10px;"></div>
|
||||||
|
<div style="width: 10px;"></div>
|
||||||
|
<div style="width: 10px;"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="flex_direction_column_reverse_border_top" style="height: 100px; width: 100px; flex-direction: column-reverse; border-top-width: 100px;">
|
||||||
|
<div style="width: 10px;"></div>
|
||||||
|
<div style="width: 10px;"></div>
|
||||||
|
<div style="width: 10px;"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="flex_direction_column_reverse_border_bottom" style="height: 100px; width: 100px; flex-direction: column-reverse; border-bottom-width: 100px;">
|
||||||
|
<div style="width: 10px;"></div>
|
||||||
|
<div style="width: 10px;"></div>
|
||||||
|
<div style="width: 10px;"></div>
|
||||||
|
</div>
|
||||||
|
@@ -1261,6 +1261,422 @@ public class YGFlexDirectionTest {
|
|||||||
assertEquals(0f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(0f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_flex_direction_row_reverse_border_left() {
|
||||||
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
|
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||||
|
|
||||||
|
final YogaNode root = createNode(config);
|
||||||
|
root.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
|
||||||
|
root.setBorder(YogaEdge.LEFT, 100f);
|
||||||
|
root.setWidth(100f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = createNode(config);
|
||||||
|
root_child0.setWidth(10f);
|
||||||
|
root.addChildAt(root_child0, 0);
|
||||||
|
|
||||||
|
final YogaNode root_child1 = createNode(config);
|
||||||
|
root_child1.setWidth(10f);
|
||||||
|
root.addChildAt(root_child1, 1);
|
||||||
|
|
||||||
|
final YogaNode root_child2 = createNode(config);
|
||||||
|
root_child2.setWidth(10f);
|
||||||
|
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(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(90f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(80f, root_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(70f, root_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, 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(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(100f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(110f, root_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(120f, root_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Ignore
|
||||||
|
public void test_flex_direction_row_reverse_border_start() {
|
||||||
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
|
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||||
|
|
||||||
|
final YogaNode root = createNode(config);
|
||||||
|
root.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
|
||||||
|
root.setBorder(YogaEdge.START, 100f);
|
||||||
|
root.setWidth(100f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = createNode(config);
|
||||||
|
root_child0.setWidth(10f);
|
||||||
|
root.addChildAt(root_child0, 0);
|
||||||
|
|
||||||
|
final YogaNode root_child1 = createNode(config);
|
||||||
|
root_child1.setWidth(10f);
|
||||||
|
root.addChildAt(root_child1, 1);
|
||||||
|
|
||||||
|
final YogaNode root_child2 = createNode(config);
|
||||||
|
root_child2.setWidth(10f);
|
||||||
|
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(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(90f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(80f, root_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(70f, root_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, 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(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(10f, root_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(20f, root_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_flex_direction_row_reverse_border_right() {
|
||||||
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
|
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||||
|
|
||||||
|
final YogaNode root = createNode(config);
|
||||||
|
root.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
|
||||||
|
root.setBorder(YogaEdge.RIGHT, 100f);
|
||||||
|
root.setWidth(100f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = createNode(config);
|
||||||
|
root_child0.setWidth(10f);
|
||||||
|
root.addChildAt(root_child0, 0);
|
||||||
|
|
||||||
|
final YogaNode root_child1 = createNode(config);
|
||||||
|
root_child1.setWidth(10f);
|
||||||
|
root.addChildAt(root_child1, 1);
|
||||||
|
|
||||||
|
final YogaNode root_child2 = createNode(config);
|
||||||
|
root_child2.setWidth(10f);
|
||||||
|
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(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(-10f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(-20f, root_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(-30f, root_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, 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(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(10f, root_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(20f, root_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Ignore
|
||||||
|
public void test_flex_direction_row_reverse_border_end() {
|
||||||
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
|
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||||
|
|
||||||
|
final YogaNode root = createNode(config);
|
||||||
|
root.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
|
||||||
|
root.setBorder(YogaEdge.END, 100f);
|
||||||
|
root.setWidth(100f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = createNode(config);
|
||||||
|
root_child0.setWidth(10f);
|
||||||
|
root.addChildAt(root_child0, 0);
|
||||||
|
|
||||||
|
final YogaNode root_child1 = createNode(config);
|
||||||
|
root_child1.setWidth(10f);
|
||||||
|
root.addChildAt(root_child1, 1);
|
||||||
|
|
||||||
|
final YogaNode root_child2 = createNode(config);
|
||||||
|
root_child2.setWidth(10f);
|
||||||
|
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(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(-10f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(-20f, root_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(-30f, root_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, 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(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(100f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(110f, root_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(120f, root_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_flex_direction_column_reverse_border_top() {
|
||||||
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
|
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||||
|
|
||||||
|
final YogaNode root = createNode(config);
|
||||||
|
root.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE);
|
||||||
|
root.setBorder(YogaEdge.TOP, 100f);
|
||||||
|
root.setWidth(100f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = createNode(config);
|
||||||
|
root_child0.setWidth(10f);
|
||||||
|
root.addChildAt(root_child0, 0);
|
||||||
|
|
||||||
|
final YogaNode root_child1 = createNode(config);
|
||||||
|
root_child1.setWidth(10f);
|
||||||
|
root.addChildAt(root_child1, 1);
|
||||||
|
|
||||||
|
final YogaNode root_child2 = createNode(config);
|
||||||
|
root_child2.setWidth(10f);
|
||||||
|
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(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(100f, root_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(100f, root_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(0f, 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(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(90f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(90f, root_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(100f, root_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(90f, root_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(100f, root_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(0f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_flex_direction_column_reverse_border_bottom() {
|
||||||
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
|
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||||
|
|
||||||
|
final YogaNode root = createNode(config);
|
||||||
|
root.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE);
|
||||||
|
root.setBorder(YogaEdge.BOTTOM, 100f);
|
||||||
|
root.setWidth(100f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = createNode(config);
|
||||||
|
root_child0.setWidth(10f);
|
||||||
|
root.addChildAt(root_child0, 0);
|
||||||
|
|
||||||
|
final YogaNode root_child1 = createNode(config);
|
||||||
|
root_child1.setWidth(10f);
|
||||||
|
root.addChildAt(root_child1, 1);
|
||||||
|
|
||||||
|
final YogaNode root_child2 = createNode(config);
|
||||||
|
root_child2.setWidth(10f);
|
||||||
|
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(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(0f, 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(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(90f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(90f, root_child1.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(90f, root_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(0f, root_child2.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
private YogaNode createNode(YogaConfig config) {
|
private YogaNode createNode(YogaConfig config) {
|
||||||
return mNodeFactory.create(config);
|
return mNodeFactory.create(config);
|
||||||
}
|
}
|
||||||
|
@@ -1365,3 +1365,453 @@ test('flex_direction_column_reverse_padding_bottom', () => {
|
|||||||
config.free();
|
config.free();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
test('flex_direction_row_reverse_border_left', () => {
|
||||||
|
const config = Yoga.Config.create();
|
||||||
|
let root;
|
||||||
|
|
||||||
|
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||||
|
|
||||||
|
try {
|
||||||
|
root = Yoga.Node.create(config);
|
||||||
|
root.setFlexDirection(FlexDirection.RowReverse);
|
||||||
|
root.setBorder(Edge.Left, 100);
|
||||||
|
root.setWidth(100);
|
||||||
|
root.setHeight(100);
|
||||||
|
|
||||||
|
const root_child0 = Yoga.Node.create(config);
|
||||||
|
root_child0.setWidth(10);
|
||||||
|
root.insertChild(root_child0, 0);
|
||||||
|
|
||||||
|
const root_child1 = Yoga.Node.create(config);
|
||||||
|
root_child1.setWidth(10);
|
||||||
|
root.insertChild(root_child1, 1);
|
||||||
|
|
||||||
|
const root_child2 = Yoga.Node.create(config);
|
||||||
|
root_child2.setWidth(10);
|
||||||
|
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(100);
|
||||||
|
expect(root.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child0.getComputedLeft()).toBe(90);
|
||||||
|
expect(root_child0.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child0.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child0.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child1.getComputedLeft()).toBe(80);
|
||||||
|
expect(root_child1.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child1.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child1.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child2.getComputedLeft()).toBe(70);
|
||||||
|
expect(root_child2.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child2.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child2.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||||
|
|
||||||
|
expect(root.getComputedLeft()).toBe(0);
|
||||||
|
expect(root.getComputedTop()).toBe(0);
|
||||||
|
expect(root.getComputedWidth()).toBe(100);
|
||||||
|
expect(root.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child0.getComputedLeft()).toBe(100);
|
||||||
|
expect(root_child0.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child0.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child0.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child1.getComputedLeft()).toBe(110);
|
||||||
|
expect(root_child1.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child1.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child1.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child2.getComputedLeft()).toBe(120);
|
||||||
|
expect(root_child2.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child2.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child2.getComputedHeight()).toBe(100);
|
||||||
|
} finally {
|
||||||
|
if (typeof root !== 'undefined') {
|
||||||
|
root.freeRecursive();
|
||||||
|
}
|
||||||
|
|
||||||
|
config.free();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
test.skip('flex_direction_row_reverse_border_start', () => {
|
||||||
|
const config = Yoga.Config.create();
|
||||||
|
let root;
|
||||||
|
|
||||||
|
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||||
|
|
||||||
|
try {
|
||||||
|
root = Yoga.Node.create(config);
|
||||||
|
root.setFlexDirection(FlexDirection.RowReverse);
|
||||||
|
root.setBorder(Edge.Start, 100);
|
||||||
|
root.setWidth(100);
|
||||||
|
root.setHeight(100);
|
||||||
|
|
||||||
|
const root_child0 = Yoga.Node.create(config);
|
||||||
|
root_child0.setWidth(10);
|
||||||
|
root.insertChild(root_child0, 0);
|
||||||
|
|
||||||
|
const root_child1 = Yoga.Node.create(config);
|
||||||
|
root_child1.setWidth(10);
|
||||||
|
root.insertChild(root_child1, 1);
|
||||||
|
|
||||||
|
const root_child2 = Yoga.Node.create(config);
|
||||||
|
root_child2.setWidth(10);
|
||||||
|
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(100);
|
||||||
|
expect(root.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child0.getComputedLeft()).toBe(90);
|
||||||
|
expect(root_child0.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child0.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child0.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child1.getComputedLeft()).toBe(80);
|
||||||
|
expect(root_child1.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child1.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child1.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child2.getComputedLeft()).toBe(70);
|
||||||
|
expect(root_child2.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child2.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child2.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||||
|
|
||||||
|
expect(root.getComputedLeft()).toBe(0);
|
||||||
|
expect(root.getComputedTop()).toBe(0);
|
||||||
|
expect(root.getComputedWidth()).toBe(100);
|
||||||
|
expect(root.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child0.getComputedLeft()).toBe(0);
|
||||||
|
expect(root_child0.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child0.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child0.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child1.getComputedLeft()).toBe(10);
|
||||||
|
expect(root_child1.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child1.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child1.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child2.getComputedLeft()).toBe(20);
|
||||||
|
expect(root_child2.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child2.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child2.getComputedHeight()).toBe(100);
|
||||||
|
} finally {
|
||||||
|
if (typeof root !== 'undefined') {
|
||||||
|
root.freeRecursive();
|
||||||
|
}
|
||||||
|
|
||||||
|
config.free();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
test('flex_direction_row_reverse_border_right', () => {
|
||||||
|
const config = Yoga.Config.create();
|
||||||
|
let root;
|
||||||
|
|
||||||
|
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||||
|
|
||||||
|
try {
|
||||||
|
root = Yoga.Node.create(config);
|
||||||
|
root.setFlexDirection(FlexDirection.RowReverse);
|
||||||
|
root.setBorder(Edge.Right, 100);
|
||||||
|
root.setWidth(100);
|
||||||
|
root.setHeight(100);
|
||||||
|
|
||||||
|
const root_child0 = Yoga.Node.create(config);
|
||||||
|
root_child0.setWidth(10);
|
||||||
|
root.insertChild(root_child0, 0);
|
||||||
|
|
||||||
|
const root_child1 = Yoga.Node.create(config);
|
||||||
|
root_child1.setWidth(10);
|
||||||
|
root.insertChild(root_child1, 1);
|
||||||
|
|
||||||
|
const root_child2 = Yoga.Node.create(config);
|
||||||
|
root_child2.setWidth(10);
|
||||||
|
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(100);
|
||||||
|
expect(root.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child0.getComputedLeft()).toBe(-10);
|
||||||
|
expect(root_child0.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child0.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child0.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child1.getComputedLeft()).toBe(-20);
|
||||||
|
expect(root_child1.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child1.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child1.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child2.getComputedLeft()).toBe(-30);
|
||||||
|
expect(root_child2.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child2.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child2.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||||
|
|
||||||
|
expect(root.getComputedLeft()).toBe(0);
|
||||||
|
expect(root.getComputedTop()).toBe(0);
|
||||||
|
expect(root.getComputedWidth()).toBe(100);
|
||||||
|
expect(root.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child0.getComputedLeft()).toBe(0);
|
||||||
|
expect(root_child0.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child0.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child0.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child1.getComputedLeft()).toBe(10);
|
||||||
|
expect(root_child1.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child1.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child1.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child2.getComputedLeft()).toBe(20);
|
||||||
|
expect(root_child2.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child2.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child2.getComputedHeight()).toBe(100);
|
||||||
|
} finally {
|
||||||
|
if (typeof root !== 'undefined') {
|
||||||
|
root.freeRecursive();
|
||||||
|
}
|
||||||
|
|
||||||
|
config.free();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
test.skip('flex_direction_row_reverse_border_end', () => {
|
||||||
|
const config = Yoga.Config.create();
|
||||||
|
let root;
|
||||||
|
|
||||||
|
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||||
|
|
||||||
|
try {
|
||||||
|
root = Yoga.Node.create(config);
|
||||||
|
root.setFlexDirection(FlexDirection.RowReverse);
|
||||||
|
root.setBorder(Edge.End, 100);
|
||||||
|
root.setWidth(100);
|
||||||
|
root.setHeight(100);
|
||||||
|
|
||||||
|
const root_child0 = Yoga.Node.create(config);
|
||||||
|
root_child0.setWidth(10);
|
||||||
|
root.insertChild(root_child0, 0);
|
||||||
|
|
||||||
|
const root_child1 = Yoga.Node.create(config);
|
||||||
|
root_child1.setWidth(10);
|
||||||
|
root.insertChild(root_child1, 1);
|
||||||
|
|
||||||
|
const root_child2 = Yoga.Node.create(config);
|
||||||
|
root_child2.setWidth(10);
|
||||||
|
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(100);
|
||||||
|
expect(root.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child0.getComputedLeft()).toBe(-10);
|
||||||
|
expect(root_child0.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child0.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child0.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child1.getComputedLeft()).toBe(-20);
|
||||||
|
expect(root_child1.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child1.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child1.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child2.getComputedLeft()).toBe(-30);
|
||||||
|
expect(root_child2.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child2.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child2.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||||
|
|
||||||
|
expect(root.getComputedLeft()).toBe(0);
|
||||||
|
expect(root.getComputedTop()).toBe(0);
|
||||||
|
expect(root.getComputedWidth()).toBe(100);
|
||||||
|
expect(root.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child0.getComputedLeft()).toBe(100);
|
||||||
|
expect(root_child0.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child0.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child0.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child1.getComputedLeft()).toBe(110);
|
||||||
|
expect(root_child1.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child1.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child1.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child2.getComputedLeft()).toBe(120);
|
||||||
|
expect(root_child2.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child2.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child2.getComputedHeight()).toBe(100);
|
||||||
|
} finally {
|
||||||
|
if (typeof root !== 'undefined') {
|
||||||
|
root.freeRecursive();
|
||||||
|
}
|
||||||
|
|
||||||
|
config.free();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
test('flex_direction_column_reverse_border_top', () => {
|
||||||
|
const config = Yoga.Config.create();
|
||||||
|
let root;
|
||||||
|
|
||||||
|
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||||
|
|
||||||
|
try {
|
||||||
|
root = Yoga.Node.create(config);
|
||||||
|
root.setFlexDirection(FlexDirection.ColumnReverse);
|
||||||
|
root.setBorder(Edge.Top, 100);
|
||||||
|
root.setWidth(100);
|
||||||
|
root.setHeight(100);
|
||||||
|
|
||||||
|
const root_child0 = Yoga.Node.create(config);
|
||||||
|
root_child0.setWidth(10);
|
||||||
|
root.insertChild(root_child0, 0);
|
||||||
|
|
||||||
|
const root_child1 = Yoga.Node.create(config);
|
||||||
|
root_child1.setWidth(10);
|
||||||
|
root.insertChild(root_child1, 1);
|
||||||
|
|
||||||
|
const root_child2 = Yoga.Node.create(config);
|
||||||
|
root_child2.setWidth(10);
|
||||||
|
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(100);
|
||||||
|
expect(root.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child0.getComputedLeft()).toBe(0);
|
||||||
|
expect(root_child0.getComputedTop()).toBe(100);
|
||||||
|
expect(root_child0.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child0.getComputedHeight()).toBe(0);
|
||||||
|
|
||||||
|
expect(root_child1.getComputedLeft()).toBe(0);
|
||||||
|
expect(root_child1.getComputedTop()).toBe(100);
|
||||||
|
expect(root_child1.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child1.getComputedHeight()).toBe(0);
|
||||||
|
|
||||||
|
expect(root_child2.getComputedLeft()).toBe(0);
|
||||||
|
expect(root_child2.getComputedTop()).toBe(100);
|
||||||
|
expect(root_child2.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child2.getComputedHeight()).toBe(0);
|
||||||
|
|
||||||
|
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||||
|
|
||||||
|
expect(root.getComputedLeft()).toBe(0);
|
||||||
|
expect(root.getComputedTop()).toBe(0);
|
||||||
|
expect(root.getComputedWidth()).toBe(100);
|
||||||
|
expect(root.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child0.getComputedLeft()).toBe(90);
|
||||||
|
expect(root_child0.getComputedTop()).toBe(100);
|
||||||
|
expect(root_child0.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child0.getComputedHeight()).toBe(0);
|
||||||
|
|
||||||
|
expect(root_child1.getComputedLeft()).toBe(90);
|
||||||
|
expect(root_child1.getComputedTop()).toBe(100);
|
||||||
|
expect(root_child1.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child1.getComputedHeight()).toBe(0);
|
||||||
|
|
||||||
|
expect(root_child2.getComputedLeft()).toBe(90);
|
||||||
|
expect(root_child2.getComputedTop()).toBe(100);
|
||||||
|
expect(root_child2.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child2.getComputedHeight()).toBe(0);
|
||||||
|
} finally {
|
||||||
|
if (typeof root !== 'undefined') {
|
||||||
|
root.freeRecursive();
|
||||||
|
}
|
||||||
|
|
||||||
|
config.free();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
test('flex_direction_column_reverse_border_bottom', () => {
|
||||||
|
const config = Yoga.Config.create();
|
||||||
|
let root;
|
||||||
|
|
||||||
|
config.setExperimentalFeatureEnabled(ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
|
||||||
|
|
||||||
|
try {
|
||||||
|
root = Yoga.Node.create(config);
|
||||||
|
root.setFlexDirection(FlexDirection.ColumnReverse);
|
||||||
|
root.setBorder(Edge.Bottom, 100);
|
||||||
|
root.setWidth(100);
|
||||||
|
root.setHeight(100);
|
||||||
|
|
||||||
|
const root_child0 = Yoga.Node.create(config);
|
||||||
|
root_child0.setWidth(10);
|
||||||
|
root.insertChild(root_child0, 0);
|
||||||
|
|
||||||
|
const root_child1 = Yoga.Node.create(config);
|
||||||
|
root_child1.setWidth(10);
|
||||||
|
root.insertChild(root_child1, 1);
|
||||||
|
|
||||||
|
const root_child2 = Yoga.Node.create(config);
|
||||||
|
root_child2.setWidth(10);
|
||||||
|
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(100);
|
||||||
|
expect(root.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child0.getComputedLeft()).toBe(0);
|
||||||
|
expect(root_child0.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child0.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child0.getComputedHeight()).toBe(0);
|
||||||
|
|
||||||
|
expect(root_child1.getComputedLeft()).toBe(0);
|
||||||
|
expect(root_child1.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child1.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child1.getComputedHeight()).toBe(0);
|
||||||
|
|
||||||
|
expect(root_child2.getComputedLeft()).toBe(0);
|
||||||
|
expect(root_child2.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child2.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child2.getComputedHeight()).toBe(0);
|
||||||
|
|
||||||
|
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||||
|
|
||||||
|
expect(root.getComputedLeft()).toBe(0);
|
||||||
|
expect(root.getComputedTop()).toBe(0);
|
||||||
|
expect(root.getComputedWidth()).toBe(100);
|
||||||
|
expect(root.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child0.getComputedLeft()).toBe(90);
|
||||||
|
expect(root_child0.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child0.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child0.getComputedHeight()).toBe(0);
|
||||||
|
|
||||||
|
expect(root_child1.getComputedLeft()).toBe(90);
|
||||||
|
expect(root_child1.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child1.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child1.getComputedHeight()).toBe(0);
|
||||||
|
|
||||||
|
expect(root_child2.getComputedLeft()).toBe(90);
|
||||||
|
expect(root_child2.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child2.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child2.getComputedHeight()).toBe(0);
|
||||||
|
} finally {
|
||||||
|
if (typeof root !== 'undefined') {
|
||||||
|
root.freeRecursive();
|
||||||
|
}
|
||||||
|
|
||||||
|
config.free();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
@@ -1268,3 +1268,427 @@ TEST(YogaTest, flex_direction_column_reverse_padding_bottom) {
|
|||||||
|
|
||||||
YGConfigFree(config);
|
YGConfigFree(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, flex_direction_row_reverse_border_left) {
|
||||||
|
const YGConfigRef config = YGConfigNew();
|
||||||
|
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||||
|
|
||||||
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRowReverse);
|
||||||
|
YGNodeStyleSetBorder(root, YGEdgeLeft, 100);
|
||||||
|
YGNodeStyleSetWidth(root, 100);
|
||||||
|
YGNodeStyleSetHeight(root, 100);
|
||||||
|
|
||||||
|
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetWidth(root_child0, 10);
|
||||||
|
YGNodeInsertChild(root, root_child0, 0);
|
||||||
|
|
||||||
|
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetWidth(root_child1, 10);
|
||||||
|
YGNodeInsertChild(root, root_child1, 1);
|
||||||
|
|
||||||
|
const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetWidth(root_child2, 10);
|
||||||
|
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(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetLeft(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(70, YGNodeLayoutGetLeft(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child2));
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(110, YGNodeLayoutGetLeft(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(120, YGNodeLayoutGetLeft(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child2));
|
||||||
|
|
||||||
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
|
YGConfigFree(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, flex_direction_row_reverse_border_start) {
|
||||||
|
GTEST_SKIP();
|
||||||
|
|
||||||
|
const YGConfigRef config = YGConfigNew();
|
||||||
|
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||||
|
|
||||||
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRowReverse);
|
||||||
|
YGNodeStyleSetBorder(root, YGEdgeStart, 100);
|
||||||
|
YGNodeStyleSetWidth(root, 100);
|
||||||
|
YGNodeStyleSetHeight(root, 100);
|
||||||
|
|
||||||
|
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetWidth(root_child0, 10);
|
||||||
|
YGNodeInsertChild(root, root_child0, 0);
|
||||||
|
|
||||||
|
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetWidth(root_child1, 10);
|
||||||
|
YGNodeInsertChild(root, root_child1, 1);
|
||||||
|
|
||||||
|
const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetWidth(root_child2, 10);
|
||||||
|
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(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetLeft(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(70, YGNodeLayoutGetLeft(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child2));
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetLeft(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child2));
|
||||||
|
|
||||||
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
|
YGConfigFree(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, flex_direction_row_reverse_border_right) {
|
||||||
|
const YGConfigRef config = YGConfigNew();
|
||||||
|
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||||
|
|
||||||
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRowReverse);
|
||||||
|
YGNodeStyleSetBorder(root, YGEdgeRight, 100);
|
||||||
|
YGNodeStyleSetWidth(root, 100);
|
||||||
|
YGNodeStyleSetHeight(root, 100);
|
||||||
|
|
||||||
|
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetWidth(root_child0, 10);
|
||||||
|
YGNodeInsertChild(root, root_child0, 0);
|
||||||
|
|
||||||
|
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetWidth(root_child1, 10);
|
||||||
|
YGNodeInsertChild(root, root_child1, 1);
|
||||||
|
|
||||||
|
const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetWidth(root_child2, 10);
|
||||||
|
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(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(-10, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(-20, YGNodeLayoutGetLeft(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(-30, YGNodeLayoutGetLeft(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child2));
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetLeft(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child2));
|
||||||
|
|
||||||
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
|
YGConfigFree(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, flex_direction_row_reverse_border_end) {
|
||||||
|
GTEST_SKIP();
|
||||||
|
|
||||||
|
const YGConfigRef config = YGConfigNew();
|
||||||
|
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||||
|
|
||||||
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRowReverse);
|
||||||
|
YGNodeStyleSetBorder(root, YGEdgeEnd, 100);
|
||||||
|
YGNodeStyleSetWidth(root, 100);
|
||||||
|
YGNodeStyleSetHeight(root, 100);
|
||||||
|
|
||||||
|
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetWidth(root_child0, 10);
|
||||||
|
YGNodeInsertChild(root, root_child0, 0);
|
||||||
|
|
||||||
|
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetWidth(root_child1, 10);
|
||||||
|
YGNodeInsertChild(root, root_child1, 1);
|
||||||
|
|
||||||
|
const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetWidth(root_child2, 10);
|
||||||
|
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(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(-10, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(-20, YGNodeLayoutGetLeft(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(-30, YGNodeLayoutGetLeft(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child2));
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(110, YGNodeLayoutGetLeft(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(120, YGNodeLayoutGetLeft(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child2));
|
||||||
|
|
||||||
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
|
YGConfigFree(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, flex_direction_column_reverse_border_top) {
|
||||||
|
const YGConfigRef config = YGConfigNew();
|
||||||
|
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||||
|
|
||||||
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetFlexDirection(root, YGFlexDirectionColumnReverse);
|
||||||
|
YGNodeStyleSetBorder(root, YGEdgeTop, 100);
|
||||||
|
YGNodeStyleSetWidth(root, 100);
|
||||||
|
YGNodeStyleSetHeight(root, 100);
|
||||||
|
|
||||||
|
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetWidth(root_child0, 10);
|
||||||
|
YGNodeInsertChild(root, root_child0, 0);
|
||||||
|
|
||||||
|
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetWidth(root_child1, 10);
|
||||||
|
YGNodeInsertChild(root, root_child1, 1);
|
||||||
|
|
||||||
|
const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetWidth(root_child2, 10);
|
||||||
|
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(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child1));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child2));
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child1));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child2));
|
||||||
|
|
||||||
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
|
YGConfigFree(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, flex_direction_column_reverse_border_bottom) {
|
||||||
|
const YGConfigRef config = YGConfigNew();
|
||||||
|
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||||
|
|
||||||
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetFlexDirection(root, YGFlexDirectionColumnReverse);
|
||||||
|
YGNodeStyleSetBorder(root, YGEdgeBottom, 100);
|
||||||
|
YGNodeStyleSetWidth(root, 100);
|
||||||
|
YGNodeStyleSetHeight(root, 100);
|
||||||
|
|
||||||
|
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetWidth(root_child0, 10);
|
||||||
|
YGNodeInsertChild(root, root_child0, 0);
|
||||||
|
|
||||||
|
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetWidth(root_child1, 10);
|
||||||
|
YGNodeInsertChild(root, root_child1, 1);
|
||||||
|
|
||||||
|
const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetWidth(root_child2, 10);
|
||||||
|
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(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child1));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child2));
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child1));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child1));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child2));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child2));
|
||||||
|
|
||||||
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
|
YGConfigFree(config);
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user