Fix row-reverse flex direction fixtures
Summary: These tests were a bit weird for testing something with position. The gentest setup makes it so that the fixtures are wrapped in a absolutely positioned container with height and width bot 0. However, the generated yoga tests do NOT do this and instead have the root node as the fixture itself with no wrapping container. This causes a problem when testing left/right/top/bottom position insets. Because left/right/top/bottom will position the element relative to its containing block when position is absolute, we will get different values on yoga and chrome even if the implementation is correct: https://developer.mozilla.org/en-US/docs/Web/CSS/right#description To fix this, we just wrap the fixture in a set size div that is also absolutely positioned. The file was also formatted. Reviewed By: NickGerleman Differential Revision: D50389229 fbshipit-source-id: ecd23939b973225cfb0611dc87f30c262952c5fc
This commit is contained in:
committed by
Facebook GitHub Bot
parent
f1f869b955
commit
2668e8e70c
@@ -34,147 +34,177 @@
|
|||||||
<div style="width: 10px;"></div>
|
<div style="width: 10px;"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="flex_direction_row_reverse_margin_left" style="height: 100px; width: 100px; flex-direction: row-reverse; margin-left: 100px;">
|
<div id="flex_direction_row_reverse_margin_left"
|
||||||
|
style="height: 100px; width: 100px; flex-direction: row-reverse; margin-left: 100px;">
|
||||||
<div style="width: 10px;"></div>
|
<div style="width: 10px;"></div>
|
||||||
<div style="width: 10px;"></div>
|
<div style="width: 10px;"></div>
|
||||||
<div style="width: 10px;"></div>
|
<div style="width: 10px;"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- gentest.rb will swap margin-start to margin-left. This is needed to use YGEdgeStart instead of YGEdgeLeft in the generated tests -->
|
<!-- gentest.rb will swap margin-start to margin-left. This is needed to use YGEdgeStart instead of YGEdgeLeft in the generated tests -->
|
||||||
<div id="flex_direction_row_reverse_margin_start" style="height: 100px; width: 100px; flex-direction: row-reverse; margin-start: 100px;">
|
<div id="flex_direction_row_reverse_margin_start"
|
||||||
|
style="height: 100px; width: 100px; flex-direction: row-reverse; margin-start: 100px;">
|
||||||
<div style="width: 10px;"></div>
|
<div style="width: 10px;"></div>
|
||||||
<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_margin_right" style="height: 100px; width: 100px; flex-direction: row-reverse; margin-right: 100px;">
|
<div id="flex_direction_row_reverse_margin_right"
|
||||||
|
style="height: 100px; width: 100px; flex-direction: row-reverse; margin-right: 100px;">
|
||||||
<div style="width: 10px;"></div>
|
<div style="width: 10px;"></div>
|
||||||
<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_margin_end" style="height: 100px; width: 100px; flex-direction: row-reverse; margin-end: 100px;">
|
<div id="flex_direction_row_reverse_margin_end"
|
||||||
|
style="height: 100px; width: 100px; flex-direction: row-reverse; margin-end: 100px;">
|
||||||
<div style="width: 10px;"></div>
|
<div style="width: 10px;"></div>
|
||||||
<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_column_reverse_margin_top" style="height: 100px; width: 100px; flex-direction: column-reverse; margin-top: 100px;">
|
<div id="flex_direction_column_reverse_margin_top"
|
||||||
|
style="height: 100px; width: 100px; flex-direction: column-reverse; margin-top: 100px;">
|
||||||
<div style="width: 10px;"></div>
|
<div style="width: 10px;"></div>
|
||||||
<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_column_reverse_margin_bottom" style="height: 100px; width: 100px; flex-direction: column-reverse; margin-bottom: 100px;">
|
<div id="flex_direction_column_reverse_margin_bottom"
|
||||||
|
style="height: 100px; width: 100px; flex-direction: column-reverse; margin-bottom: 100px;">
|
||||||
<div style="width: 10px;"></div>
|
<div style="width: 10px;"></div>
|
||||||
<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_padding_left" style="height: 100px; width: 100px; flex-direction: row-reverse; padding-left: 100px;">
|
<div id="flex_direction_row_reverse_padding_left"
|
||||||
|
style="height: 100px; width: 100px; flex-direction: row-reverse; padding-left: 100px;">
|
||||||
<div style="width: 10px;"></div>
|
<div style="width: 10px;"></div>
|
||||||
<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_padding_start" style="height: 100px; width: 100px; flex-direction: row-reverse; padding-start: 100px;">
|
<div id="flex_direction_row_reverse_padding_start"
|
||||||
|
style="height: 100px; width: 100px; flex-direction: row-reverse; padding-start: 100px;">
|
||||||
<div style="width: 10px;"></div>
|
<div style="width: 10px;"></div>
|
||||||
<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_padding_right" style="height: 100px; width: 100px; flex-direction: row-reverse; padding-right: 100px;">
|
<div id="flex_direction_row_reverse_padding_right"
|
||||||
|
style="height: 100px; width: 100px; flex-direction: row-reverse; padding-right: 100px;">
|
||||||
<div style="width: 10px;"></div>
|
<div style="width: 10px;"></div>
|
||||||
<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_padding_end" style="height: 100px; width: 100px; flex-direction: row-reverse; padding-end: 100px;">
|
<div id="flex_direction_row_reverse_padding_end"
|
||||||
|
style="height: 100px; width: 100px; flex-direction: row-reverse; padding-end: 100px;">
|
||||||
<div style="width: 10px;"></div>
|
<div style="width: 10px;"></div>
|
||||||
<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_column_reverse_padding_top" style="height: 100px; width: 100px; flex-direction: column-reverse; padding-top: 100px;">
|
<div id="flex_direction_column_reverse_padding_top"
|
||||||
|
style="height: 100px; width: 100px; flex-direction: column-reverse; padding-top: 100px;">
|
||||||
<div style="width: 10px;"></div>
|
<div style="width: 10px;"></div>
|
||||||
<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_column_reverse_padding_bottom" style="height: 100px; width: 100px; flex-direction: column-reverse; padding-bottom: 100px;">
|
<div id="flex_direction_column_reverse_padding_bottom"
|
||||||
|
style="height: 100px; width: 100px; flex-direction: column-reverse; padding-bottom: 100px;">
|
||||||
<div style="width: 10px;"></div>
|
<div style="width: 10px;"></div>
|
||||||
<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 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 style="width: 10px;"></div>
|
||||||
<div style="width: 10px;"></div>
|
<div style="width: 10px;"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="flex_direction_row_reverse_border_start" style="height: 100px; width: 100px; flex-direction: row-reverse; border-start-width: 100px;">
|
<div id="flex_direction_row_reverse_border_start"
|
||||||
|
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 style="width: 10px;"></div>
|
||||||
<div style="width: 10px;"></div>
|
<div style="width: 10px;"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="flex_direction_row_reverse_border_right" style="height: 100px; width: 100px; flex-direction: row-reverse; border-right-width: 100px;">
|
<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 style="width: 10px;"></div>
|
||||||
<div style="width: 10px;"></div>
|
<div style="width: 10px;"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="flex_direction_row_reverse_border_end" style="height: 100px; width: 100px; flex-direction: row-reverse; border-end-width: 100px;">
|
<div id="flex_direction_row_reverse_border_end"
|
||||||
|
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 style="width: 10px;"></div>
|
||||||
<div style="width: 10px;"></div>
|
<div style="width: 10px;"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="flex_direction_column_reverse_border_top" style="height: 100px; width: 100px; flex-direction: column-reverse; border-top-width: 100px;">
|
<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 style="width: 10px;"></div>
|
||||||
<div style="width: 10px;"></div>
|
<div style="width: 10px;"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="flex_direction_column_reverse_border_bottom" style="height: 100px; width: 100px; flex-direction: column-reverse; border-bottom-width: 100px;">
|
<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 style="width: 10px;"></div>
|
||||||
<div style="width: 10px;"></div>
|
<div style="width: 10px;"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="flex_direction_row_reverse_pos_left" data-disabled="true" style="height: 100px; width: 100px; flex-direction: row-reverse; left: 100px;">
|
<div id="flex_direction_row_reverse_pos_left" data-disabled="true" style="height: 100px; width: 100px;">
|
||||||
<div style="width: 10px;"></div>
|
<div style="height: 100px; width: 100px; flex-direction: row-reverse; left: 100px;">
|
||||||
<div style="width: 10px;"></div>
|
<div style="width: 10px;"></div>
|
||||||
<div style="width: 10px;"></div>
|
<div style="width: 10px;"></div>
|
||||||
|
<div style="width: 10px;"></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="flex_direction_row_reverse_pos_start" data-disabled="true" style="height: 100px; width: 100px; flex-direction: row-reverse; start: 100px;">
|
<div id="flex_direction_row_reverse_pos_start" style="height: 100px; width: 100px;">
|
||||||
<div style="width: 10px;"></div>
|
<div style="height: 100px; width: 100px; flex-direction: row-reverse; start: 100px;">
|
||||||
<div style="width: 10px;"></div>
|
<div style="width: 10px;"></div>
|
||||||
<div style="width: 10px;"></div>
|
<div style="width: 10px;"></div>
|
||||||
|
<div style="width: 10px;"></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="flex_direction_row_reverse_pos_right" data-disabled="true" style="height: 100px; width: 100px; flex-direction: row-reverse; right: 100px;">
|
<div id="flex_direction_row_reverse_pos_right" data-disabled="true" style="height: 100px; width: 100px;">
|
||||||
<div style="width: 10px;"></div>
|
<div style="height: 100px; width: 100px; flex-direction: row-reverse; right: 100px;">
|
||||||
<div style="width: 10px;"></div>
|
<div style="width: 10px;"></div>
|
||||||
<div style="width: 10px;"></div>
|
<div style="width: 10px;"></div>
|
||||||
|
<div style="width: 10px;"></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="flex_direction_row_reverse_pos_end" data-disabled="true" style="height: 100px; width: 100px; flex-direction: row-reverse; end: 100px;">
|
<div id="flex_direction_row_reverse_pos_end" style="height: 100px; width: 100px;">
|
||||||
<div style="width: 10px;"></div>
|
<div style="height: 100px; width: 100px; flex-direction: row-reverse; end: 100px;">
|
||||||
<div style="width: 10px;"></div>
|
<div style="width: 10px;"></div>
|
||||||
<div style="width: 10px;"></div>
|
<div style="width: 10px;"></div>
|
||||||
|
<div style="width: 10px;"></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="flex_direction_column_reverse_pos_top" data-disabled="true" style="height: 100px; width: 100px; flex-direction: column-reverse; top: 100px;">
|
<div id="flex_direction_column_reverse_pos_top" data-disabled="true" style="height: 100px; width: 100px;">
|
||||||
<div style="width: 10px;"></div>
|
<div style="height: 100px; width: 100px; flex-direction: column-reverse; top: 100px;">
|
||||||
<div style="width: 10px;"></div>
|
<div style="width: 10px;"></div>
|
||||||
<div style="width: 10px;"></div>
|
<div style="width: 10px;"></div>
|
||||||
|
<div style="width: 10px;"></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="flex_direction_column_reverse_pos_bottom" data-disabled="true" style="height: 100px; width: 100px; flex-direction: column-reverse; bottom: 100px;">
|
<div id="flex_direction_column_reverse_pos_bottom" data-disabled="true" style="height: 100px; width: 100px;">
|
||||||
<div style="width: 10px;"></div>
|
<div style="height: 100px; width: 100px; flex-direction: column-reverse; bottom: 100px;">
|
||||||
<div style="width: 10px;"></div>
|
<div style="width: 10px;"></div>
|
||||||
<div style="width: 10px;"></div>
|
<div style="width: 10px;"></div>
|
||||||
|
<div style="width: 10px;"></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1678,137 +1678,166 @@ public class YGFlexDirectionTest {
|
|||||||
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||||
|
|
||||||
final YogaNode root = createNode(config);
|
final YogaNode root = createNode(config);
|
||||||
root.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
|
|
||||||
root.setPosition(YogaEdge.LEFT, 100f);
|
|
||||||
root.setWidth(100f);
|
root.setWidth(100f);
|
||||||
root.setHeight(100f);
|
root.setHeight(100f);
|
||||||
|
|
||||||
final YogaNode root_child0 = createNode(config);
|
final YogaNode root_child0 = createNode(config);
|
||||||
root_child0.setWidth(10f);
|
root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
|
||||||
|
root_child0.setPosition(YogaEdge.LEFT, 100f);
|
||||||
|
root_child0.setWidth(100f);
|
||||||
|
root_child0.setHeight(100f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
|
|
||||||
final YogaNode root_child1 = createNode(config);
|
final YogaNode root_child0_child0 = createNode(config);
|
||||||
root_child1.setWidth(10f);
|
root_child0_child0.setWidth(10f);
|
||||||
root.addChildAt(root_child1, 1);
|
root_child0.addChildAt(root_child0_child0, 0);
|
||||||
|
|
||||||
final YogaNode root_child2 = createNode(config);
|
final YogaNode root_child0_child1 = createNode(config);
|
||||||
root_child2.setWidth(10f);
|
root_child0_child1.setWidth(10f);
|
||||||
root.addChildAt(root_child2, 2);
|
root_child0.addChildAt(root_child0_child1, 1);
|
||||||
|
|
||||||
|
final YogaNode root_child0_child2 = createNode(config);
|
||||||
|
root_child0_child2.setWidth(10f);
|
||||||
|
root_child0.addChildAt(root_child0_child2, 2);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(100f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(90f, root_child0.getLayoutX(), 0.0f);
|
assertEquals(100f, root_child0.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(80f, root_child1.getLayoutX(), 0.0f);
|
assertEquals(90f, root_child0_child0.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||||
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
|
assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(70f, root_child2.getLayoutX(), 0.0f);
|
assertEquals(80f, root_child0_child1.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
|
||||||
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
|
assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(70f, root_child0_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(100f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
assertEquals(100f, root_child0.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(10f, root_child1.getLayoutX(), 0.0f);
|
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||||
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
|
assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(20f, root_child2.getLayoutX(), 0.0f);
|
assertEquals(10f, root_child0_child1.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
|
||||||
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
|
assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Ignore
|
|
||||||
public void test_flex_direction_row_reverse_pos_start() {
|
public void test_flex_direction_row_reverse_pos_start() {
|
||||||
YogaConfig config = YogaConfigFactory.create();
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||||
|
|
||||||
final YogaNode root = createNode(config);
|
final YogaNode root = createNode(config);
|
||||||
root.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
|
|
||||||
root.setPosition(YogaEdge.START, 100f);
|
|
||||||
root.setWidth(100f);
|
root.setWidth(100f);
|
||||||
root.setHeight(100f);
|
root.setHeight(100f);
|
||||||
|
|
||||||
final YogaNode root_child0 = createNode(config);
|
final YogaNode root_child0 = createNode(config);
|
||||||
root_child0.setWidth(10f);
|
root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
|
||||||
|
root_child0.setPosition(YogaEdge.START, 100f);
|
||||||
|
root_child0.setWidth(100f);
|
||||||
|
root_child0.setHeight(100f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
|
|
||||||
final YogaNode root_child1 = createNode(config);
|
final YogaNode root_child0_child0 = createNode(config);
|
||||||
root_child1.setWidth(10f);
|
root_child0_child0.setWidth(10f);
|
||||||
root.addChildAt(root_child1, 1);
|
root_child0.addChildAt(root_child0_child0, 0);
|
||||||
|
|
||||||
final YogaNode root_child2 = createNode(config);
|
final YogaNode root_child0_child1 = createNode(config);
|
||||||
root_child2.setWidth(10f);
|
root_child0_child1.setWidth(10f);
|
||||||
root.addChildAt(root_child2, 2);
|
root_child0.addChildAt(root_child0_child1, 1);
|
||||||
|
|
||||||
|
final YogaNode root_child0_child2 = createNode(config);
|
||||||
|
root_child0_child2.setWidth(10f);
|
||||||
|
root_child0.addChildAt(root_child0_child2, 2);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(100f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(90f, root_child0.getLayoutX(), 0.0f);
|
assertEquals(100f, root_child0.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(80f, root_child1.getLayoutX(), 0.0f);
|
assertEquals(90f, root_child0_child0.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||||
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
|
assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(70f, root_child2.getLayoutX(), 0.0f);
|
assertEquals(80f, root_child0_child1.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
|
||||||
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
|
assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(70f, root_child0_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(-200f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
assertEquals(-100f, root_child0.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(10f, root_child1.getLayoutX(), 0.0f);
|
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||||
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
|
assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(20f, root_child2.getLayoutX(), 0.0f);
|
assertEquals(10f, root_child0_child1.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
|
||||||
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
|
assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -1818,137 +1847,166 @@ public class YGFlexDirectionTest {
|
|||||||
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||||
|
|
||||||
final YogaNode root = createNode(config);
|
final YogaNode root = createNode(config);
|
||||||
root.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
|
|
||||||
root.setPosition(YogaEdge.RIGHT, 100f);
|
|
||||||
root.setWidth(100f);
|
root.setWidth(100f);
|
||||||
root.setHeight(100f);
|
root.setHeight(100f);
|
||||||
|
|
||||||
final YogaNode root_child0 = createNode(config);
|
final YogaNode root_child0 = createNode(config);
|
||||||
root_child0.setWidth(10f);
|
root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
|
||||||
|
root_child0.setPosition(YogaEdge.RIGHT, 100f);
|
||||||
|
root_child0.setWidth(100f);
|
||||||
|
root_child0.setHeight(100f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
|
|
||||||
final YogaNode root_child1 = createNode(config);
|
final YogaNode root_child0_child0 = createNode(config);
|
||||||
root_child1.setWidth(10f);
|
root_child0_child0.setWidth(10f);
|
||||||
root.addChildAt(root_child1, 1);
|
root_child0.addChildAt(root_child0_child0, 0);
|
||||||
|
|
||||||
final YogaNode root_child2 = createNode(config);
|
final YogaNode root_child0_child1 = createNode(config);
|
||||||
root_child2.setWidth(10f);
|
root_child0_child1.setWidth(10f);
|
||||||
root.addChildAt(root_child2, 2);
|
root_child0.addChildAt(root_child0_child1, 1);
|
||||||
|
|
||||||
|
final YogaNode root_child0_child2 = createNode(config);
|
||||||
|
root_child0_child2.setWidth(10f);
|
||||||
|
root_child0.addChildAt(root_child0_child2, 2);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(-200f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(90f, root_child0.getLayoutX(), 0.0f);
|
assertEquals(-100f, root_child0.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(80f, root_child1.getLayoutX(), 0.0f);
|
assertEquals(90f, root_child0_child0.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||||
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
|
assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(70f, root_child2.getLayoutX(), 0.0f);
|
assertEquals(80f, root_child0_child1.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
|
||||||
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
|
assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(70f, root_child0_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(-200f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
assertEquals(-100f, root_child0.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(10f, root_child1.getLayoutX(), 0.0f);
|
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||||
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
|
assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(20f, root_child2.getLayoutX(), 0.0f);
|
assertEquals(10f, root_child0_child1.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
|
||||||
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
|
assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Ignore
|
|
||||||
public void test_flex_direction_row_reverse_pos_end() {
|
public void test_flex_direction_row_reverse_pos_end() {
|
||||||
YogaConfig config = YogaConfigFactory.create();
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||||
|
|
||||||
final YogaNode root = createNode(config);
|
final YogaNode root = createNode(config);
|
||||||
root.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
|
|
||||||
root.setPosition(YogaEdge.END, 100f);
|
|
||||||
root.setWidth(100f);
|
root.setWidth(100f);
|
||||||
root.setHeight(100f);
|
root.setHeight(100f);
|
||||||
|
|
||||||
final YogaNode root_child0 = createNode(config);
|
final YogaNode root_child0 = createNode(config);
|
||||||
root_child0.setWidth(10f);
|
root_child0.setFlexDirection(YogaFlexDirection.ROW_REVERSE);
|
||||||
|
root_child0.setPosition(YogaEdge.END, 100f);
|
||||||
|
root_child0.setWidth(100f);
|
||||||
|
root_child0.setHeight(100f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
|
|
||||||
final YogaNode root_child1 = createNode(config);
|
final YogaNode root_child0_child0 = createNode(config);
|
||||||
root_child1.setWidth(10f);
|
root_child0_child0.setWidth(10f);
|
||||||
root.addChildAt(root_child1, 1);
|
root_child0.addChildAt(root_child0_child0, 0);
|
||||||
|
|
||||||
final YogaNode root_child2 = createNode(config);
|
final YogaNode root_child0_child1 = createNode(config);
|
||||||
root_child2.setWidth(10f);
|
root_child0_child1.setWidth(10f);
|
||||||
root.addChildAt(root_child2, 2);
|
root_child0.addChildAt(root_child0_child1, 1);
|
||||||
|
|
||||||
|
final YogaNode root_child0_child2 = createNode(config);
|
||||||
|
root_child0_child2.setWidth(10f);
|
||||||
|
root_child0.addChildAt(root_child0_child2, 2);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(-200f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(90f, root_child0.getLayoutX(), 0.0f);
|
assertEquals(-100f, root_child0.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(80f, root_child1.getLayoutX(), 0.0f);
|
assertEquals(90f, root_child0_child0.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||||
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
|
assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(70f, root_child2.getLayoutX(), 0.0f);
|
assertEquals(80f, root_child0_child1.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
|
||||||
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
|
assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(70f, root_child0_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(100f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
assertEquals(100f, root_child0.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(10f, root_child1.getLayoutX(), 0.0f);
|
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
|
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||||
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
|
assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(20f, root_child2.getLayoutX(), 0.0f);
|
assertEquals(10f, root_child0_child1.getLayoutX(), 0.0f);
|
||||||
assertEquals(0f, root_child2.getLayoutY(), 0.0f);
|
assertEquals(0f, root_child0_child1.getLayoutY(), 0.0f);
|
||||||
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
|
assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(20f, root_child0_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -1958,67 +2016,82 @@ public class YGFlexDirectionTest {
|
|||||||
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||||
|
|
||||||
final YogaNode root = createNode(config);
|
final YogaNode root = createNode(config);
|
||||||
root.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE);
|
|
||||||
root.setPosition(YogaEdge.TOP, 100f);
|
|
||||||
root.setWidth(100f);
|
root.setWidth(100f);
|
||||||
root.setHeight(100f);
|
root.setHeight(100f);
|
||||||
|
|
||||||
final YogaNode root_child0 = createNode(config);
|
final YogaNode root_child0 = createNode(config);
|
||||||
root_child0.setWidth(10f);
|
root_child0.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE);
|
||||||
|
root_child0.setPosition(YogaEdge.TOP, 100f);
|
||||||
|
root_child0.setWidth(100f);
|
||||||
|
root_child0.setHeight(100f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
|
|
||||||
final YogaNode root_child1 = createNode(config);
|
final YogaNode root_child0_child0 = createNode(config);
|
||||||
root_child1.setWidth(10f);
|
root_child0_child0.setWidth(10f);
|
||||||
root.addChildAt(root_child1, 1);
|
root_child0.addChildAt(root_child0_child0, 0);
|
||||||
|
|
||||||
final YogaNode root_child2 = createNode(config);
|
final YogaNode root_child0_child1 = createNode(config);
|
||||||
root_child2.setWidth(10f);
|
root_child0_child1.setWidth(10f);
|
||||||
root.addChildAt(root_child2, 2);
|
root_child0.addChildAt(root_child0_child1, 1);
|
||||||
|
|
||||||
|
final YogaNode root_child0_child2 = createNode(config);
|
||||||
|
root_child0_child2.setWidth(10f);
|
||||||
|
root_child0.addChildAt(root_child0_child2, 2);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(100f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||||
assertEquals(100f, root_child0.getLayoutY(), 0.0f);
|
assertEquals(100f, root_child0.getLayoutY(), 0.0f);
|
||||||
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
|
||||||
assertEquals(100f, root_child1.getLayoutY(), 0.0f);
|
assertEquals(100f, root_child0_child0.getLayoutY(), 0.0f);
|
||||||
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
|
assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
|
assertEquals(0f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
|
||||||
assertEquals(100f, root_child2.getLayoutY(), 0.0f);
|
assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f);
|
||||||
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
|
assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(0f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(100f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(90f, root_child0.getLayoutX(), 0.0f);
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||||
assertEquals(100f, root_child0.getLayoutY(), 0.0f);
|
assertEquals(100f, root_child0.getLayoutY(), 0.0f);
|
||||||
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(90f, root_child1.getLayoutX(), 0.0f);
|
assertEquals(90f, root_child0_child0.getLayoutX(), 0.0f);
|
||||||
assertEquals(100f, root_child1.getLayoutY(), 0.0f);
|
assertEquals(100f, root_child0_child0.getLayoutY(), 0.0f);
|
||||||
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
|
assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
|
assertEquals(0f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(90f, root_child2.getLayoutX(), 0.0f);
|
assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f);
|
||||||
assertEquals(100f, root_child2.getLayoutY(), 0.0f);
|
assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f);
|
||||||
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
|
assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(0f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(90f, root_child0_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -2028,67 +2101,82 @@ public class YGFlexDirectionTest {
|
|||||||
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE, true);
|
||||||
|
|
||||||
final YogaNode root = createNode(config);
|
final YogaNode root = createNode(config);
|
||||||
root.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE);
|
|
||||||
root.setPosition(YogaEdge.BOTTOM, 100f);
|
|
||||||
root.setWidth(100f);
|
root.setWidth(100f);
|
||||||
root.setHeight(100f);
|
root.setHeight(100f);
|
||||||
|
|
||||||
final YogaNode root_child0 = createNode(config);
|
final YogaNode root_child0 = createNode(config);
|
||||||
root_child0.setWidth(10f);
|
root_child0.setFlexDirection(YogaFlexDirection.COLUMN_REVERSE);
|
||||||
|
root_child0.setPosition(YogaEdge.BOTTOM, 100f);
|
||||||
|
root_child0.setWidth(100f);
|
||||||
|
root_child0.setHeight(100f);
|
||||||
root.addChildAt(root_child0, 0);
|
root.addChildAt(root_child0, 0);
|
||||||
|
|
||||||
final YogaNode root_child1 = createNode(config);
|
final YogaNode root_child0_child0 = createNode(config);
|
||||||
root_child1.setWidth(10f);
|
root_child0_child0.setWidth(10f);
|
||||||
root.addChildAt(root_child1, 1);
|
root_child0.addChildAt(root_child0_child0, 0);
|
||||||
|
|
||||||
final YogaNode root_child2 = createNode(config);
|
final YogaNode root_child0_child1 = createNode(config);
|
||||||
root_child2.setWidth(10f);
|
root_child0_child1.setWidth(10f);
|
||||||
root.addChildAt(root_child2, 2);
|
root_child0.addChildAt(root_child0_child1, 1);
|
||||||
|
|
||||||
|
final YogaNode root_child0_child2 = createNode(config);
|
||||||
|
root_child0_child2.setWidth(10f);
|
||||||
|
root_child0.addChildAt(root_child0_child2, 2);
|
||||||
root.setDirection(YogaDirection.LTR);
|
root.setDirection(YogaDirection.LTR);
|
||||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(-200f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||||
assertEquals(100f, root_child0.getLayoutY(), 0.0f);
|
assertEquals(-100f, root_child0.getLayoutY(), 0.0f);
|
||||||
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
|
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
|
||||||
assertEquals(100f, root_child1.getLayoutY(), 0.0f);
|
assertEquals(100f, root_child0_child0.getLayoutY(), 0.0f);
|
||||||
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
|
assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
|
assertEquals(0f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
|
assertEquals(0f, root_child0_child1.getLayoutX(), 0.0f);
|
||||||
assertEquals(100f, root_child2.getLayoutY(), 0.0f);
|
assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f);
|
||||||
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
|
assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(0f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
root.setDirection(YogaDirection.RTL);
|
root.setDirection(YogaDirection.RTL);
|
||||||
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
assertEquals(0f, root.getLayoutX(), 0.0f);
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
assertEquals(-200f, root.getLayoutY(), 0.0f);
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(90f, root_child0.getLayoutX(), 0.0f);
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||||
assertEquals(100f, root_child0.getLayoutY(), 0.0f);
|
assertEquals(-100f, root_child0.getLayoutY(), 0.0f);
|
||||||
assertEquals(10f, root_child0.getLayoutWidth(), 0.0f);
|
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(90f, root_child1.getLayoutX(), 0.0f);
|
assertEquals(90f, root_child0_child0.getLayoutX(), 0.0f);
|
||||||
assertEquals(100f, root_child1.getLayoutY(), 0.0f);
|
assertEquals(100f, root_child0_child0.getLayoutY(), 0.0f);
|
||||||
assertEquals(10f, root_child1.getLayoutWidth(), 0.0f);
|
assertEquals(10f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(0f, root_child1.getLayoutHeight(), 0.0f);
|
assertEquals(0f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
assertEquals(90f, root_child2.getLayoutX(), 0.0f);
|
assertEquals(90f, root_child0_child1.getLayoutX(), 0.0f);
|
||||||
assertEquals(100f, root_child2.getLayoutY(), 0.0f);
|
assertEquals(100f, root_child0_child1.getLayoutY(), 0.0f);
|
||||||
assertEquals(10f, root_child2.getLayoutWidth(), 0.0f);
|
assertEquals(10f, root_child0_child1.getLayoutWidth(), 0.0f);
|
||||||
assertEquals(0f, root_child2.getLayoutHeight(), 0.0f);
|
assertEquals(0f, root_child0_child1.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(90f, root_child0_child2.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0_child2.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(10f, root_child0_child2.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0_child2.getLayoutHeight(), 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
private YogaNode createNode(YogaConfig config) {
|
private YogaNode createNode(YogaConfig config) {
|
||||||
|
@@ -1823,65 +1823,80 @@ test.skip('flex_direction_row_reverse_pos_left', () => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
root = Yoga.Node.create(config);
|
root = Yoga.Node.create(config);
|
||||||
root.setFlexDirection(FlexDirection.RowReverse);
|
|
||||||
root.setPosition(Edge.Left, 100);
|
|
||||||
root.setWidth(100);
|
root.setWidth(100);
|
||||||
root.setHeight(100);
|
root.setHeight(100);
|
||||||
|
|
||||||
const root_child0 = Yoga.Node.create(config);
|
const root_child0 = Yoga.Node.create(config);
|
||||||
root_child0.setWidth(10);
|
root_child0.setFlexDirection(FlexDirection.RowReverse);
|
||||||
|
root_child0.setPosition(Edge.Left, 100);
|
||||||
|
root_child0.setWidth(100);
|
||||||
|
root_child0.setHeight(100);
|
||||||
root.insertChild(root_child0, 0);
|
root.insertChild(root_child0, 0);
|
||||||
|
|
||||||
const root_child1 = Yoga.Node.create(config);
|
const root_child0_child0 = Yoga.Node.create(config);
|
||||||
root_child1.setWidth(10);
|
root_child0_child0.setWidth(10);
|
||||||
root.insertChild(root_child1, 1);
|
root_child0.insertChild(root_child0_child0, 0);
|
||||||
|
|
||||||
const root_child2 = Yoga.Node.create(config);
|
const root_child0_child1 = Yoga.Node.create(config);
|
||||||
root_child2.setWidth(10);
|
root_child0_child1.setWidth(10);
|
||||||
root.insertChild(root_child2, 2);
|
root_child0.insertChild(root_child0_child1, 1);
|
||||||
|
|
||||||
|
const root_child0_child2 = Yoga.Node.create(config);
|
||||||
|
root_child0_child2.setWidth(10);
|
||||||
|
root_child0.insertChild(root_child0_child2, 2);
|
||||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||||
|
|
||||||
expect(root.getComputedLeft()).toBe(100);
|
expect(root.getComputedLeft()).toBe(0);
|
||||||
expect(root.getComputedTop()).toBe(0);
|
expect(root.getComputedTop()).toBe(0);
|
||||||
expect(root.getComputedWidth()).toBe(100);
|
expect(root.getComputedWidth()).toBe(100);
|
||||||
expect(root.getComputedHeight()).toBe(100);
|
expect(root.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
expect(root_child0.getComputedLeft()).toBe(90);
|
expect(root_child0.getComputedLeft()).toBe(100);
|
||||||
expect(root_child0.getComputedTop()).toBe(0);
|
expect(root_child0.getComputedTop()).toBe(0);
|
||||||
expect(root_child0.getComputedWidth()).toBe(10);
|
expect(root_child0.getComputedWidth()).toBe(100);
|
||||||
expect(root_child0.getComputedHeight()).toBe(100);
|
expect(root_child0.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
expect(root_child1.getComputedLeft()).toBe(80);
|
expect(root_child0_child0.getComputedLeft()).toBe(90);
|
||||||
expect(root_child1.getComputedTop()).toBe(0);
|
expect(root_child0_child0.getComputedTop()).toBe(0);
|
||||||
expect(root_child1.getComputedWidth()).toBe(10);
|
expect(root_child0_child0.getComputedWidth()).toBe(10);
|
||||||
expect(root_child1.getComputedHeight()).toBe(100);
|
expect(root_child0_child0.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
expect(root_child2.getComputedLeft()).toBe(70);
|
expect(root_child0_child1.getComputedLeft()).toBe(80);
|
||||||
expect(root_child2.getComputedTop()).toBe(0);
|
expect(root_child0_child1.getComputedTop()).toBe(0);
|
||||||
expect(root_child2.getComputedWidth()).toBe(10);
|
expect(root_child0_child1.getComputedWidth()).toBe(10);
|
||||||
expect(root_child2.getComputedHeight()).toBe(100);
|
expect(root_child0_child1.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child0_child2.getComputedLeft()).toBe(70);
|
||||||
|
expect(root_child0_child2.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child0_child2.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child0_child2.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||||
|
|
||||||
expect(root.getComputedLeft()).toBe(100);
|
expect(root.getComputedLeft()).toBe(0);
|
||||||
expect(root.getComputedTop()).toBe(0);
|
expect(root.getComputedTop()).toBe(0);
|
||||||
expect(root.getComputedWidth()).toBe(100);
|
expect(root.getComputedWidth()).toBe(100);
|
||||||
expect(root.getComputedHeight()).toBe(100);
|
expect(root.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
expect(root_child0.getComputedLeft()).toBe(0);
|
expect(root_child0.getComputedLeft()).toBe(100);
|
||||||
expect(root_child0.getComputedTop()).toBe(0);
|
expect(root_child0.getComputedTop()).toBe(0);
|
||||||
expect(root_child0.getComputedWidth()).toBe(10);
|
expect(root_child0.getComputedWidth()).toBe(100);
|
||||||
expect(root_child0.getComputedHeight()).toBe(100);
|
expect(root_child0.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
expect(root_child1.getComputedLeft()).toBe(10);
|
expect(root_child0_child0.getComputedLeft()).toBe(0);
|
||||||
expect(root_child1.getComputedTop()).toBe(0);
|
expect(root_child0_child0.getComputedTop()).toBe(0);
|
||||||
expect(root_child1.getComputedWidth()).toBe(10);
|
expect(root_child0_child0.getComputedWidth()).toBe(10);
|
||||||
expect(root_child1.getComputedHeight()).toBe(100);
|
expect(root_child0_child0.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
expect(root_child2.getComputedLeft()).toBe(20);
|
expect(root_child0_child1.getComputedLeft()).toBe(10);
|
||||||
expect(root_child2.getComputedTop()).toBe(0);
|
expect(root_child0_child1.getComputedTop()).toBe(0);
|
||||||
expect(root_child2.getComputedWidth()).toBe(10);
|
expect(root_child0_child1.getComputedWidth()).toBe(10);
|
||||||
expect(root_child2.getComputedHeight()).toBe(100);
|
expect(root_child0_child1.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child0_child2.getComputedLeft()).toBe(20);
|
||||||
|
expect(root_child0_child2.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child0_child2.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child0_child2.getComputedHeight()).toBe(100);
|
||||||
} finally {
|
} finally {
|
||||||
if (typeof root !== 'undefined') {
|
if (typeof root !== 'undefined') {
|
||||||
root.freeRecursive();
|
root.freeRecursive();
|
||||||
@@ -1890,7 +1905,7 @@ test.skip('flex_direction_row_reverse_pos_left', () => {
|
|||||||
config.free();
|
config.free();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
test.skip('flex_direction_row_reverse_pos_start', () => {
|
test('flex_direction_row_reverse_pos_start', () => {
|
||||||
const config = Yoga.Config.create();
|
const config = Yoga.Config.create();
|
||||||
let root;
|
let root;
|
||||||
|
|
||||||
@@ -1898,65 +1913,80 @@ test.skip('flex_direction_row_reverse_pos_start', () => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
root = Yoga.Node.create(config);
|
root = Yoga.Node.create(config);
|
||||||
root.setFlexDirection(FlexDirection.RowReverse);
|
|
||||||
root.setPosition(Edge.Start, 100);
|
|
||||||
root.setWidth(100);
|
root.setWidth(100);
|
||||||
root.setHeight(100);
|
root.setHeight(100);
|
||||||
|
|
||||||
const root_child0 = Yoga.Node.create(config);
|
const root_child0 = Yoga.Node.create(config);
|
||||||
root_child0.setWidth(10);
|
root_child0.setFlexDirection(FlexDirection.RowReverse);
|
||||||
|
root_child0.setPosition(Edge.Start, 100);
|
||||||
|
root_child0.setWidth(100);
|
||||||
|
root_child0.setHeight(100);
|
||||||
root.insertChild(root_child0, 0);
|
root.insertChild(root_child0, 0);
|
||||||
|
|
||||||
const root_child1 = Yoga.Node.create(config);
|
const root_child0_child0 = Yoga.Node.create(config);
|
||||||
root_child1.setWidth(10);
|
root_child0_child0.setWidth(10);
|
||||||
root.insertChild(root_child1, 1);
|
root_child0.insertChild(root_child0_child0, 0);
|
||||||
|
|
||||||
const root_child2 = Yoga.Node.create(config);
|
const root_child0_child1 = Yoga.Node.create(config);
|
||||||
root_child2.setWidth(10);
|
root_child0_child1.setWidth(10);
|
||||||
root.insertChild(root_child2, 2);
|
root_child0.insertChild(root_child0_child1, 1);
|
||||||
|
|
||||||
|
const root_child0_child2 = Yoga.Node.create(config);
|
||||||
|
root_child0_child2.setWidth(10);
|
||||||
|
root_child0.insertChild(root_child0_child2, 2);
|
||||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||||
|
|
||||||
expect(root.getComputedLeft()).toBe(100);
|
expect(root.getComputedLeft()).toBe(0);
|
||||||
expect(root.getComputedTop()).toBe(0);
|
expect(root.getComputedTop()).toBe(0);
|
||||||
expect(root.getComputedWidth()).toBe(100);
|
expect(root.getComputedWidth()).toBe(100);
|
||||||
expect(root.getComputedHeight()).toBe(100);
|
expect(root.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
expect(root_child0.getComputedLeft()).toBe(90);
|
expect(root_child0.getComputedLeft()).toBe(100);
|
||||||
expect(root_child0.getComputedTop()).toBe(0);
|
expect(root_child0.getComputedTop()).toBe(0);
|
||||||
expect(root_child0.getComputedWidth()).toBe(10);
|
expect(root_child0.getComputedWidth()).toBe(100);
|
||||||
expect(root_child0.getComputedHeight()).toBe(100);
|
expect(root_child0.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
expect(root_child1.getComputedLeft()).toBe(80);
|
expect(root_child0_child0.getComputedLeft()).toBe(90);
|
||||||
expect(root_child1.getComputedTop()).toBe(0);
|
expect(root_child0_child0.getComputedTop()).toBe(0);
|
||||||
expect(root_child1.getComputedWidth()).toBe(10);
|
expect(root_child0_child0.getComputedWidth()).toBe(10);
|
||||||
expect(root_child1.getComputedHeight()).toBe(100);
|
expect(root_child0_child0.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
expect(root_child2.getComputedLeft()).toBe(70);
|
expect(root_child0_child1.getComputedLeft()).toBe(80);
|
||||||
expect(root_child2.getComputedTop()).toBe(0);
|
expect(root_child0_child1.getComputedTop()).toBe(0);
|
||||||
expect(root_child2.getComputedWidth()).toBe(10);
|
expect(root_child0_child1.getComputedWidth()).toBe(10);
|
||||||
expect(root_child2.getComputedHeight()).toBe(100);
|
expect(root_child0_child1.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child0_child2.getComputedLeft()).toBe(70);
|
||||||
|
expect(root_child0_child2.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child0_child2.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child0_child2.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||||
|
|
||||||
expect(root.getComputedLeft()).toBe(-200);
|
expect(root.getComputedLeft()).toBe(0);
|
||||||
expect(root.getComputedTop()).toBe(0);
|
expect(root.getComputedTop()).toBe(0);
|
||||||
expect(root.getComputedWidth()).toBe(100);
|
expect(root.getComputedWidth()).toBe(100);
|
||||||
expect(root.getComputedHeight()).toBe(100);
|
expect(root.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
expect(root_child0.getComputedLeft()).toBe(0);
|
expect(root_child0.getComputedLeft()).toBe(-100);
|
||||||
expect(root_child0.getComputedTop()).toBe(0);
|
expect(root_child0.getComputedTop()).toBe(0);
|
||||||
expect(root_child0.getComputedWidth()).toBe(10);
|
expect(root_child0.getComputedWidth()).toBe(100);
|
||||||
expect(root_child0.getComputedHeight()).toBe(100);
|
expect(root_child0.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
expect(root_child1.getComputedLeft()).toBe(10);
|
expect(root_child0_child0.getComputedLeft()).toBe(0);
|
||||||
expect(root_child1.getComputedTop()).toBe(0);
|
expect(root_child0_child0.getComputedTop()).toBe(0);
|
||||||
expect(root_child1.getComputedWidth()).toBe(10);
|
expect(root_child0_child0.getComputedWidth()).toBe(10);
|
||||||
expect(root_child1.getComputedHeight()).toBe(100);
|
expect(root_child0_child0.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
expect(root_child2.getComputedLeft()).toBe(20);
|
expect(root_child0_child1.getComputedLeft()).toBe(10);
|
||||||
expect(root_child2.getComputedTop()).toBe(0);
|
expect(root_child0_child1.getComputedTop()).toBe(0);
|
||||||
expect(root_child2.getComputedWidth()).toBe(10);
|
expect(root_child0_child1.getComputedWidth()).toBe(10);
|
||||||
expect(root_child2.getComputedHeight()).toBe(100);
|
expect(root_child0_child1.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child0_child2.getComputedLeft()).toBe(20);
|
||||||
|
expect(root_child0_child2.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child0_child2.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child0_child2.getComputedHeight()).toBe(100);
|
||||||
} finally {
|
} finally {
|
||||||
if (typeof root !== 'undefined') {
|
if (typeof root !== 'undefined') {
|
||||||
root.freeRecursive();
|
root.freeRecursive();
|
||||||
@@ -1973,65 +2003,80 @@ test.skip('flex_direction_row_reverse_pos_right', () => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
root = Yoga.Node.create(config);
|
root = Yoga.Node.create(config);
|
||||||
root.setFlexDirection(FlexDirection.RowReverse);
|
|
||||||
root.setPosition(Edge.Right, 100);
|
|
||||||
root.setWidth(100);
|
root.setWidth(100);
|
||||||
root.setHeight(100);
|
root.setHeight(100);
|
||||||
|
|
||||||
const root_child0 = Yoga.Node.create(config);
|
const root_child0 = Yoga.Node.create(config);
|
||||||
root_child0.setWidth(10);
|
root_child0.setFlexDirection(FlexDirection.RowReverse);
|
||||||
|
root_child0.setPosition(Edge.Right, 100);
|
||||||
|
root_child0.setWidth(100);
|
||||||
|
root_child0.setHeight(100);
|
||||||
root.insertChild(root_child0, 0);
|
root.insertChild(root_child0, 0);
|
||||||
|
|
||||||
const root_child1 = Yoga.Node.create(config);
|
const root_child0_child0 = Yoga.Node.create(config);
|
||||||
root_child1.setWidth(10);
|
root_child0_child0.setWidth(10);
|
||||||
root.insertChild(root_child1, 1);
|
root_child0.insertChild(root_child0_child0, 0);
|
||||||
|
|
||||||
const root_child2 = Yoga.Node.create(config);
|
const root_child0_child1 = Yoga.Node.create(config);
|
||||||
root_child2.setWidth(10);
|
root_child0_child1.setWidth(10);
|
||||||
root.insertChild(root_child2, 2);
|
root_child0.insertChild(root_child0_child1, 1);
|
||||||
|
|
||||||
|
const root_child0_child2 = Yoga.Node.create(config);
|
||||||
|
root_child0_child2.setWidth(10);
|
||||||
|
root_child0.insertChild(root_child0_child2, 2);
|
||||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||||
|
|
||||||
expect(root.getComputedLeft()).toBe(-200);
|
expect(root.getComputedLeft()).toBe(0);
|
||||||
expect(root.getComputedTop()).toBe(0);
|
expect(root.getComputedTop()).toBe(0);
|
||||||
expect(root.getComputedWidth()).toBe(100);
|
expect(root.getComputedWidth()).toBe(100);
|
||||||
expect(root.getComputedHeight()).toBe(100);
|
expect(root.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
expect(root_child0.getComputedLeft()).toBe(90);
|
expect(root_child0.getComputedLeft()).toBe(-100);
|
||||||
expect(root_child0.getComputedTop()).toBe(0);
|
expect(root_child0.getComputedTop()).toBe(0);
|
||||||
expect(root_child0.getComputedWidth()).toBe(10);
|
expect(root_child0.getComputedWidth()).toBe(100);
|
||||||
expect(root_child0.getComputedHeight()).toBe(100);
|
expect(root_child0.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
expect(root_child1.getComputedLeft()).toBe(80);
|
expect(root_child0_child0.getComputedLeft()).toBe(90);
|
||||||
expect(root_child1.getComputedTop()).toBe(0);
|
expect(root_child0_child0.getComputedTop()).toBe(0);
|
||||||
expect(root_child1.getComputedWidth()).toBe(10);
|
expect(root_child0_child0.getComputedWidth()).toBe(10);
|
||||||
expect(root_child1.getComputedHeight()).toBe(100);
|
expect(root_child0_child0.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
expect(root_child2.getComputedLeft()).toBe(70);
|
expect(root_child0_child1.getComputedLeft()).toBe(80);
|
||||||
expect(root_child2.getComputedTop()).toBe(0);
|
expect(root_child0_child1.getComputedTop()).toBe(0);
|
||||||
expect(root_child2.getComputedWidth()).toBe(10);
|
expect(root_child0_child1.getComputedWidth()).toBe(10);
|
||||||
expect(root_child2.getComputedHeight()).toBe(100);
|
expect(root_child0_child1.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child0_child2.getComputedLeft()).toBe(70);
|
||||||
|
expect(root_child0_child2.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child0_child2.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child0_child2.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||||
|
|
||||||
expect(root.getComputedLeft()).toBe(-200);
|
expect(root.getComputedLeft()).toBe(0);
|
||||||
expect(root.getComputedTop()).toBe(0);
|
expect(root.getComputedTop()).toBe(0);
|
||||||
expect(root.getComputedWidth()).toBe(100);
|
expect(root.getComputedWidth()).toBe(100);
|
||||||
expect(root.getComputedHeight()).toBe(100);
|
expect(root.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
expect(root_child0.getComputedLeft()).toBe(0);
|
expect(root_child0.getComputedLeft()).toBe(-100);
|
||||||
expect(root_child0.getComputedTop()).toBe(0);
|
expect(root_child0.getComputedTop()).toBe(0);
|
||||||
expect(root_child0.getComputedWidth()).toBe(10);
|
expect(root_child0.getComputedWidth()).toBe(100);
|
||||||
expect(root_child0.getComputedHeight()).toBe(100);
|
expect(root_child0.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
expect(root_child1.getComputedLeft()).toBe(10);
|
expect(root_child0_child0.getComputedLeft()).toBe(0);
|
||||||
expect(root_child1.getComputedTop()).toBe(0);
|
expect(root_child0_child0.getComputedTop()).toBe(0);
|
||||||
expect(root_child1.getComputedWidth()).toBe(10);
|
expect(root_child0_child0.getComputedWidth()).toBe(10);
|
||||||
expect(root_child1.getComputedHeight()).toBe(100);
|
expect(root_child0_child0.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
expect(root_child2.getComputedLeft()).toBe(20);
|
expect(root_child0_child1.getComputedLeft()).toBe(10);
|
||||||
expect(root_child2.getComputedTop()).toBe(0);
|
expect(root_child0_child1.getComputedTop()).toBe(0);
|
||||||
expect(root_child2.getComputedWidth()).toBe(10);
|
expect(root_child0_child1.getComputedWidth()).toBe(10);
|
||||||
expect(root_child2.getComputedHeight()).toBe(100);
|
expect(root_child0_child1.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child0_child2.getComputedLeft()).toBe(20);
|
||||||
|
expect(root_child0_child2.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child0_child2.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child0_child2.getComputedHeight()).toBe(100);
|
||||||
} finally {
|
} finally {
|
||||||
if (typeof root !== 'undefined') {
|
if (typeof root !== 'undefined') {
|
||||||
root.freeRecursive();
|
root.freeRecursive();
|
||||||
@@ -2040,7 +2085,7 @@ test.skip('flex_direction_row_reverse_pos_right', () => {
|
|||||||
config.free();
|
config.free();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
test.skip('flex_direction_row_reverse_pos_end', () => {
|
test('flex_direction_row_reverse_pos_end', () => {
|
||||||
const config = Yoga.Config.create();
|
const config = Yoga.Config.create();
|
||||||
let root;
|
let root;
|
||||||
|
|
||||||
@@ -2048,65 +2093,80 @@ test.skip('flex_direction_row_reverse_pos_end', () => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
root = Yoga.Node.create(config);
|
root = Yoga.Node.create(config);
|
||||||
root.setFlexDirection(FlexDirection.RowReverse);
|
|
||||||
root.setPosition(Edge.End, 100);
|
|
||||||
root.setWidth(100);
|
root.setWidth(100);
|
||||||
root.setHeight(100);
|
root.setHeight(100);
|
||||||
|
|
||||||
const root_child0 = Yoga.Node.create(config);
|
const root_child0 = Yoga.Node.create(config);
|
||||||
root_child0.setWidth(10);
|
root_child0.setFlexDirection(FlexDirection.RowReverse);
|
||||||
|
root_child0.setPosition(Edge.End, 100);
|
||||||
|
root_child0.setWidth(100);
|
||||||
|
root_child0.setHeight(100);
|
||||||
root.insertChild(root_child0, 0);
|
root.insertChild(root_child0, 0);
|
||||||
|
|
||||||
const root_child1 = Yoga.Node.create(config);
|
const root_child0_child0 = Yoga.Node.create(config);
|
||||||
root_child1.setWidth(10);
|
root_child0_child0.setWidth(10);
|
||||||
root.insertChild(root_child1, 1);
|
root_child0.insertChild(root_child0_child0, 0);
|
||||||
|
|
||||||
const root_child2 = Yoga.Node.create(config);
|
const root_child0_child1 = Yoga.Node.create(config);
|
||||||
root_child2.setWidth(10);
|
root_child0_child1.setWidth(10);
|
||||||
root.insertChild(root_child2, 2);
|
root_child0.insertChild(root_child0_child1, 1);
|
||||||
|
|
||||||
|
const root_child0_child2 = Yoga.Node.create(config);
|
||||||
|
root_child0_child2.setWidth(10);
|
||||||
|
root_child0.insertChild(root_child0_child2, 2);
|
||||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||||
|
|
||||||
expect(root.getComputedLeft()).toBe(-200);
|
expect(root.getComputedLeft()).toBe(0);
|
||||||
expect(root.getComputedTop()).toBe(0);
|
expect(root.getComputedTop()).toBe(0);
|
||||||
expect(root.getComputedWidth()).toBe(100);
|
expect(root.getComputedWidth()).toBe(100);
|
||||||
expect(root.getComputedHeight()).toBe(100);
|
expect(root.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
expect(root_child0.getComputedLeft()).toBe(90);
|
expect(root_child0.getComputedLeft()).toBe(-100);
|
||||||
expect(root_child0.getComputedTop()).toBe(0);
|
expect(root_child0.getComputedTop()).toBe(0);
|
||||||
expect(root_child0.getComputedWidth()).toBe(10);
|
expect(root_child0.getComputedWidth()).toBe(100);
|
||||||
expect(root_child0.getComputedHeight()).toBe(100);
|
expect(root_child0.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
expect(root_child1.getComputedLeft()).toBe(80);
|
expect(root_child0_child0.getComputedLeft()).toBe(90);
|
||||||
expect(root_child1.getComputedTop()).toBe(0);
|
expect(root_child0_child0.getComputedTop()).toBe(0);
|
||||||
expect(root_child1.getComputedWidth()).toBe(10);
|
expect(root_child0_child0.getComputedWidth()).toBe(10);
|
||||||
expect(root_child1.getComputedHeight()).toBe(100);
|
expect(root_child0_child0.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
expect(root_child2.getComputedLeft()).toBe(70);
|
expect(root_child0_child1.getComputedLeft()).toBe(80);
|
||||||
expect(root_child2.getComputedTop()).toBe(0);
|
expect(root_child0_child1.getComputedTop()).toBe(0);
|
||||||
expect(root_child2.getComputedWidth()).toBe(10);
|
expect(root_child0_child1.getComputedWidth()).toBe(10);
|
||||||
expect(root_child2.getComputedHeight()).toBe(100);
|
expect(root_child0_child1.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child0_child2.getComputedLeft()).toBe(70);
|
||||||
|
expect(root_child0_child2.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child0_child2.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child0_child2.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||||
|
|
||||||
expect(root.getComputedLeft()).toBe(100);
|
expect(root.getComputedLeft()).toBe(0);
|
||||||
expect(root.getComputedTop()).toBe(0);
|
expect(root.getComputedTop()).toBe(0);
|
||||||
expect(root.getComputedWidth()).toBe(100);
|
expect(root.getComputedWidth()).toBe(100);
|
||||||
expect(root.getComputedHeight()).toBe(100);
|
expect(root.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
expect(root_child0.getComputedLeft()).toBe(0);
|
expect(root_child0.getComputedLeft()).toBe(100);
|
||||||
expect(root_child0.getComputedTop()).toBe(0);
|
expect(root_child0.getComputedTop()).toBe(0);
|
||||||
expect(root_child0.getComputedWidth()).toBe(10);
|
expect(root_child0.getComputedWidth()).toBe(100);
|
||||||
expect(root_child0.getComputedHeight()).toBe(100);
|
expect(root_child0.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
expect(root_child1.getComputedLeft()).toBe(10);
|
expect(root_child0_child0.getComputedLeft()).toBe(0);
|
||||||
expect(root_child1.getComputedTop()).toBe(0);
|
expect(root_child0_child0.getComputedTop()).toBe(0);
|
||||||
expect(root_child1.getComputedWidth()).toBe(10);
|
expect(root_child0_child0.getComputedWidth()).toBe(10);
|
||||||
expect(root_child1.getComputedHeight()).toBe(100);
|
expect(root_child0_child0.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
expect(root_child2.getComputedLeft()).toBe(20);
|
expect(root_child0_child1.getComputedLeft()).toBe(10);
|
||||||
expect(root_child2.getComputedTop()).toBe(0);
|
expect(root_child0_child1.getComputedTop()).toBe(0);
|
||||||
expect(root_child2.getComputedWidth()).toBe(10);
|
expect(root_child0_child1.getComputedWidth()).toBe(10);
|
||||||
expect(root_child2.getComputedHeight()).toBe(100);
|
expect(root_child0_child1.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
|
expect(root_child0_child2.getComputedLeft()).toBe(20);
|
||||||
|
expect(root_child0_child2.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child0_child2.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child0_child2.getComputedHeight()).toBe(100);
|
||||||
} finally {
|
} finally {
|
||||||
if (typeof root !== 'undefined') {
|
if (typeof root !== 'undefined') {
|
||||||
root.freeRecursive();
|
root.freeRecursive();
|
||||||
@@ -2123,65 +2183,80 @@ test.skip('flex_direction_column_reverse_pos_top', () => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
root = Yoga.Node.create(config);
|
root = Yoga.Node.create(config);
|
||||||
root.setFlexDirection(FlexDirection.ColumnReverse);
|
|
||||||
root.setPosition(Edge.Top, 100);
|
|
||||||
root.setWidth(100);
|
root.setWidth(100);
|
||||||
root.setHeight(100);
|
root.setHeight(100);
|
||||||
|
|
||||||
const root_child0 = Yoga.Node.create(config);
|
const root_child0 = Yoga.Node.create(config);
|
||||||
root_child0.setWidth(10);
|
root_child0.setFlexDirection(FlexDirection.ColumnReverse);
|
||||||
|
root_child0.setPosition(Edge.Top, 100);
|
||||||
|
root_child0.setWidth(100);
|
||||||
|
root_child0.setHeight(100);
|
||||||
root.insertChild(root_child0, 0);
|
root.insertChild(root_child0, 0);
|
||||||
|
|
||||||
const root_child1 = Yoga.Node.create(config);
|
const root_child0_child0 = Yoga.Node.create(config);
|
||||||
root_child1.setWidth(10);
|
root_child0_child0.setWidth(10);
|
||||||
root.insertChild(root_child1, 1);
|
root_child0.insertChild(root_child0_child0, 0);
|
||||||
|
|
||||||
const root_child2 = Yoga.Node.create(config);
|
const root_child0_child1 = Yoga.Node.create(config);
|
||||||
root_child2.setWidth(10);
|
root_child0_child1.setWidth(10);
|
||||||
root.insertChild(root_child2, 2);
|
root_child0.insertChild(root_child0_child1, 1);
|
||||||
|
|
||||||
|
const root_child0_child2 = Yoga.Node.create(config);
|
||||||
|
root_child0_child2.setWidth(10);
|
||||||
|
root_child0.insertChild(root_child0_child2, 2);
|
||||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||||
|
|
||||||
expect(root.getComputedLeft()).toBe(0);
|
expect(root.getComputedLeft()).toBe(0);
|
||||||
expect(root.getComputedTop()).toBe(100);
|
expect(root.getComputedTop()).toBe(0);
|
||||||
expect(root.getComputedWidth()).toBe(100);
|
expect(root.getComputedWidth()).toBe(100);
|
||||||
expect(root.getComputedHeight()).toBe(100);
|
expect(root.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
expect(root_child0.getComputedLeft()).toBe(0);
|
expect(root_child0.getComputedLeft()).toBe(0);
|
||||||
expect(root_child0.getComputedTop()).toBe(100);
|
expect(root_child0.getComputedTop()).toBe(100);
|
||||||
expect(root_child0.getComputedWidth()).toBe(10);
|
expect(root_child0.getComputedWidth()).toBe(100);
|
||||||
expect(root_child0.getComputedHeight()).toBe(0);
|
expect(root_child0.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
expect(root_child1.getComputedLeft()).toBe(0);
|
expect(root_child0_child0.getComputedLeft()).toBe(0);
|
||||||
expect(root_child1.getComputedTop()).toBe(100);
|
expect(root_child0_child0.getComputedTop()).toBe(100);
|
||||||
expect(root_child1.getComputedWidth()).toBe(10);
|
expect(root_child0_child0.getComputedWidth()).toBe(10);
|
||||||
expect(root_child1.getComputedHeight()).toBe(0);
|
expect(root_child0_child0.getComputedHeight()).toBe(0);
|
||||||
|
|
||||||
expect(root_child2.getComputedLeft()).toBe(0);
|
expect(root_child0_child1.getComputedLeft()).toBe(0);
|
||||||
expect(root_child2.getComputedTop()).toBe(100);
|
expect(root_child0_child1.getComputedTop()).toBe(100);
|
||||||
expect(root_child2.getComputedWidth()).toBe(10);
|
expect(root_child0_child1.getComputedWidth()).toBe(10);
|
||||||
expect(root_child2.getComputedHeight()).toBe(0);
|
expect(root_child0_child1.getComputedHeight()).toBe(0);
|
||||||
|
|
||||||
|
expect(root_child0_child2.getComputedLeft()).toBe(0);
|
||||||
|
expect(root_child0_child2.getComputedTop()).toBe(100);
|
||||||
|
expect(root_child0_child2.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child0_child2.getComputedHeight()).toBe(0);
|
||||||
|
|
||||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||||
|
|
||||||
expect(root.getComputedLeft()).toBe(0);
|
expect(root.getComputedLeft()).toBe(0);
|
||||||
expect(root.getComputedTop()).toBe(100);
|
expect(root.getComputedTop()).toBe(0);
|
||||||
expect(root.getComputedWidth()).toBe(100);
|
expect(root.getComputedWidth()).toBe(100);
|
||||||
expect(root.getComputedHeight()).toBe(100);
|
expect(root.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
expect(root_child0.getComputedLeft()).toBe(90);
|
expect(root_child0.getComputedLeft()).toBe(0);
|
||||||
expect(root_child0.getComputedTop()).toBe(100);
|
expect(root_child0.getComputedTop()).toBe(100);
|
||||||
expect(root_child0.getComputedWidth()).toBe(10);
|
expect(root_child0.getComputedWidth()).toBe(100);
|
||||||
expect(root_child0.getComputedHeight()).toBe(0);
|
expect(root_child0.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
expect(root_child1.getComputedLeft()).toBe(90);
|
expect(root_child0_child0.getComputedLeft()).toBe(90);
|
||||||
expect(root_child1.getComputedTop()).toBe(100);
|
expect(root_child0_child0.getComputedTop()).toBe(100);
|
||||||
expect(root_child1.getComputedWidth()).toBe(10);
|
expect(root_child0_child0.getComputedWidth()).toBe(10);
|
||||||
expect(root_child1.getComputedHeight()).toBe(0);
|
expect(root_child0_child0.getComputedHeight()).toBe(0);
|
||||||
|
|
||||||
expect(root_child2.getComputedLeft()).toBe(90);
|
expect(root_child0_child1.getComputedLeft()).toBe(90);
|
||||||
expect(root_child2.getComputedTop()).toBe(100);
|
expect(root_child0_child1.getComputedTop()).toBe(100);
|
||||||
expect(root_child2.getComputedWidth()).toBe(10);
|
expect(root_child0_child1.getComputedWidth()).toBe(10);
|
||||||
expect(root_child2.getComputedHeight()).toBe(0);
|
expect(root_child0_child1.getComputedHeight()).toBe(0);
|
||||||
|
|
||||||
|
expect(root_child0_child2.getComputedLeft()).toBe(90);
|
||||||
|
expect(root_child0_child2.getComputedTop()).toBe(100);
|
||||||
|
expect(root_child0_child2.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child0_child2.getComputedHeight()).toBe(0);
|
||||||
} finally {
|
} finally {
|
||||||
if (typeof root !== 'undefined') {
|
if (typeof root !== 'undefined') {
|
||||||
root.freeRecursive();
|
root.freeRecursive();
|
||||||
@@ -2198,65 +2273,80 @@ test.skip('flex_direction_column_reverse_pos_bottom', () => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
root = Yoga.Node.create(config);
|
root = Yoga.Node.create(config);
|
||||||
root.setFlexDirection(FlexDirection.ColumnReverse);
|
|
||||||
root.setPosition(Edge.Bottom, 100);
|
|
||||||
root.setWidth(100);
|
root.setWidth(100);
|
||||||
root.setHeight(100);
|
root.setHeight(100);
|
||||||
|
|
||||||
const root_child0 = Yoga.Node.create(config);
|
const root_child0 = Yoga.Node.create(config);
|
||||||
root_child0.setWidth(10);
|
root_child0.setFlexDirection(FlexDirection.ColumnReverse);
|
||||||
|
root_child0.setPosition(Edge.Bottom, 100);
|
||||||
|
root_child0.setWidth(100);
|
||||||
|
root_child0.setHeight(100);
|
||||||
root.insertChild(root_child0, 0);
|
root.insertChild(root_child0, 0);
|
||||||
|
|
||||||
const root_child1 = Yoga.Node.create(config);
|
const root_child0_child0 = Yoga.Node.create(config);
|
||||||
root_child1.setWidth(10);
|
root_child0_child0.setWidth(10);
|
||||||
root.insertChild(root_child1, 1);
|
root_child0.insertChild(root_child0_child0, 0);
|
||||||
|
|
||||||
const root_child2 = Yoga.Node.create(config);
|
const root_child0_child1 = Yoga.Node.create(config);
|
||||||
root_child2.setWidth(10);
|
root_child0_child1.setWidth(10);
|
||||||
root.insertChild(root_child2, 2);
|
root_child0.insertChild(root_child0_child1, 1);
|
||||||
|
|
||||||
|
const root_child0_child2 = Yoga.Node.create(config);
|
||||||
|
root_child0_child2.setWidth(10);
|
||||||
|
root_child0.insertChild(root_child0_child2, 2);
|
||||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||||
|
|
||||||
expect(root.getComputedLeft()).toBe(0);
|
expect(root.getComputedLeft()).toBe(0);
|
||||||
expect(root.getComputedTop()).toBe(-200);
|
expect(root.getComputedTop()).toBe(0);
|
||||||
expect(root.getComputedWidth()).toBe(100);
|
expect(root.getComputedWidth()).toBe(100);
|
||||||
expect(root.getComputedHeight()).toBe(100);
|
expect(root.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
expect(root_child0.getComputedLeft()).toBe(0);
|
expect(root_child0.getComputedLeft()).toBe(0);
|
||||||
expect(root_child0.getComputedTop()).toBe(100);
|
expect(root_child0.getComputedTop()).toBe(-100);
|
||||||
expect(root_child0.getComputedWidth()).toBe(10);
|
expect(root_child0.getComputedWidth()).toBe(100);
|
||||||
expect(root_child0.getComputedHeight()).toBe(0);
|
expect(root_child0.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
expect(root_child1.getComputedLeft()).toBe(0);
|
expect(root_child0_child0.getComputedLeft()).toBe(0);
|
||||||
expect(root_child1.getComputedTop()).toBe(100);
|
expect(root_child0_child0.getComputedTop()).toBe(100);
|
||||||
expect(root_child1.getComputedWidth()).toBe(10);
|
expect(root_child0_child0.getComputedWidth()).toBe(10);
|
||||||
expect(root_child1.getComputedHeight()).toBe(0);
|
expect(root_child0_child0.getComputedHeight()).toBe(0);
|
||||||
|
|
||||||
expect(root_child2.getComputedLeft()).toBe(0);
|
expect(root_child0_child1.getComputedLeft()).toBe(0);
|
||||||
expect(root_child2.getComputedTop()).toBe(100);
|
expect(root_child0_child1.getComputedTop()).toBe(100);
|
||||||
expect(root_child2.getComputedWidth()).toBe(10);
|
expect(root_child0_child1.getComputedWidth()).toBe(10);
|
||||||
expect(root_child2.getComputedHeight()).toBe(0);
|
expect(root_child0_child1.getComputedHeight()).toBe(0);
|
||||||
|
|
||||||
|
expect(root_child0_child2.getComputedLeft()).toBe(0);
|
||||||
|
expect(root_child0_child2.getComputedTop()).toBe(100);
|
||||||
|
expect(root_child0_child2.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child0_child2.getComputedHeight()).toBe(0);
|
||||||
|
|
||||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||||
|
|
||||||
expect(root.getComputedLeft()).toBe(0);
|
expect(root.getComputedLeft()).toBe(0);
|
||||||
expect(root.getComputedTop()).toBe(-200);
|
expect(root.getComputedTop()).toBe(0);
|
||||||
expect(root.getComputedWidth()).toBe(100);
|
expect(root.getComputedWidth()).toBe(100);
|
||||||
expect(root.getComputedHeight()).toBe(100);
|
expect(root.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
expect(root_child0.getComputedLeft()).toBe(90);
|
expect(root_child0.getComputedLeft()).toBe(0);
|
||||||
expect(root_child0.getComputedTop()).toBe(100);
|
expect(root_child0.getComputedTop()).toBe(-100);
|
||||||
expect(root_child0.getComputedWidth()).toBe(10);
|
expect(root_child0.getComputedWidth()).toBe(100);
|
||||||
expect(root_child0.getComputedHeight()).toBe(0);
|
expect(root_child0.getComputedHeight()).toBe(100);
|
||||||
|
|
||||||
expect(root_child1.getComputedLeft()).toBe(90);
|
expect(root_child0_child0.getComputedLeft()).toBe(90);
|
||||||
expect(root_child1.getComputedTop()).toBe(100);
|
expect(root_child0_child0.getComputedTop()).toBe(100);
|
||||||
expect(root_child1.getComputedWidth()).toBe(10);
|
expect(root_child0_child0.getComputedWidth()).toBe(10);
|
||||||
expect(root_child1.getComputedHeight()).toBe(0);
|
expect(root_child0_child0.getComputedHeight()).toBe(0);
|
||||||
|
|
||||||
expect(root_child2.getComputedLeft()).toBe(90);
|
expect(root_child0_child1.getComputedLeft()).toBe(90);
|
||||||
expect(root_child2.getComputedTop()).toBe(100);
|
expect(root_child0_child1.getComputedTop()).toBe(100);
|
||||||
expect(root_child2.getComputedWidth()).toBe(10);
|
expect(root_child0_child1.getComputedWidth()).toBe(10);
|
||||||
expect(root_child2.getComputedHeight()).toBe(0);
|
expect(root_child0_child1.getComputedHeight()).toBe(0);
|
||||||
|
|
||||||
|
expect(root_child0_child2.getComputedLeft()).toBe(90);
|
||||||
|
expect(root_child0_child2.getComputedTop()).toBe(100);
|
||||||
|
expect(root_child0_child2.getComputedWidth()).toBe(10);
|
||||||
|
expect(root_child0_child2.getComputedHeight()).toBe(0);
|
||||||
} finally {
|
} finally {
|
||||||
if (typeof root !== 'undefined') {
|
if (typeof root !== 'undefined') {
|
||||||
root.freeRecursive();
|
root.freeRecursive();
|
||||||
|
@@ -1688,65 +1688,80 @@ TEST(YogaTest, flex_direction_row_reverse_pos_left) {
|
|||||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||||
|
|
||||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRowReverse);
|
|
||||||
YGNodeStyleSetPosition(root, YGEdgeLeft, 100);
|
|
||||||
YGNodeStyleSetWidth(root, 100);
|
YGNodeStyleSetWidth(root, 100);
|
||||||
YGNodeStyleSetHeight(root, 100);
|
YGNodeStyleSetHeight(root, 100);
|
||||||
|
|
||||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||||
YGNodeStyleSetWidth(root_child0, 10);
|
YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRowReverse);
|
||||||
|
YGNodeStyleSetPosition(root_child0, YGEdgeLeft, 100);
|
||||||
|
YGNodeStyleSetWidth(root_child0, 100);
|
||||||
|
YGNodeStyleSetHeight(root_child0, 100);
|
||||||
YGNodeInsertChild(root, root_child0, 0);
|
YGNodeInsertChild(root, root_child0, 0);
|
||||||
|
|
||||||
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
|
||||||
YGNodeStyleSetWidth(root_child1, 10);
|
YGNodeStyleSetWidth(root_child0_child0, 10);
|
||||||
YGNodeInsertChild(root, root_child1, 1);
|
YGNodeInsertChild(root_child0, root_child0_child0, 0);
|
||||||
|
|
||||||
const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
|
const YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config);
|
||||||
YGNodeStyleSetWidth(root_child2, 10);
|
YGNodeStyleSetWidth(root_child0_child1, 10);
|
||||||
YGNodeInsertChild(root, root_child2, 2);
|
YGNodeInsertChild(root_child0, root_child0_child1, 1);
|
||||||
|
|
||||||
|
const YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetWidth(root_child0_child2, 10);
|
||||||
|
YGNodeInsertChild(root_child0, root_child0_child2, 2);
|
||||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child0));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetLeft(root_child1));
|
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child0_child0));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child1));
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child0));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(70, YGNodeLayoutGetLeft(root_child2));
|
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetLeft(root_child0_child1));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child1));
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child2));
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child1));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child2));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(70, YGNodeLayoutGetLeft(root_child0_child2));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child2));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child2));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child2));
|
||||||
|
|
||||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetLeft(root_child1));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child1));
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child0));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child2));
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetLeft(root_child0_child1));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child1));
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child2));
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child1));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child2));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child2));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child2));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child2));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child2));
|
||||||
|
|
||||||
YGNodeFreeRecursive(root);
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
@@ -1754,71 +1769,84 @@ TEST(YogaTest, flex_direction_row_reverse_pos_left) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(YogaTest, flex_direction_row_reverse_pos_start) {
|
TEST(YogaTest, flex_direction_row_reverse_pos_start) {
|
||||||
GTEST_SKIP();
|
|
||||||
|
|
||||||
const YGConfigRef config = YGConfigNew();
|
const YGConfigRef config = YGConfigNew();
|
||||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||||
|
|
||||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRowReverse);
|
|
||||||
YGNodeStyleSetPosition(root, YGEdgeStart, 100);
|
|
||||||
YGNodeStyleSetWidth(root, 100);
|
YGNodeStyleSetWidth(root, 100);
|
||||||
YGNodeStyleSetHeight(root, 100);
|
YGNodeStyleSetHeight(root, 100);
|
||||||
|
|
||||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||||
YGNodeStyleSetWidth(root_child0, 10);
|
YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRowReverse);
|
||||||
|
YGNodeStyleSetPosition(root_child0, YGEdgeStart, 100);
|
||||||
|
YGNodeStyleSetWidth(root_child0, 100);
|
||||||
|
YGNodeStyleSetHeight(root_child0, 100);
|
||||||
YGNodeInsertChild(root, root_child0, 0);
|
YGNodeInsertChild(root, root_child0, 0);
|
||||||
|
|
||||||
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
|
||||||
YGNodeStyleSetWidth(root_child1, 10);
|
YGNodeStyleSetWidth(root_child0_child0, 10);
|
||||||
YGNodeInsertChild(root, root_child1, 1);
|
YGNodeInsertChild(root_child0, root_child0_child0, 0);
|
||||||
|
|
||||||
const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
|
const YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config);
|
||||||
YGNodeStyleSetWidth(root_child2, 10);
|
YGNodeStyleSetWidth(root_child0_child1, 10);
|
||||||
YGNodeInsertChild(root, root_child2, 2);
|
YGNodeInsertChild(root_child0, root_child0_child1, 1);
|
||||||
|
|
||||||
|
const YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetWidth(root_child0_child2, 10);
|
||||||
|
YGNodeInsertChild(root_child0, root_child0_child2, 2);
|
||||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child0));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetLeft(root_child1));
|
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child0_child0));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child1));
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child0));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(70, YGNodeLayoutGetLeft(root_child2));
|
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetLeft(root_child0_child1));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child1));
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child2));
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child1));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child2));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(70, YGNodeLayoutGetLeft(root_child0_child2));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child2));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child2));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child2));
|
||||||
|
|
||||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(-200, YGNodeLayoutGetLeft(root));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
ASSERT_FLOAT_EQ(-100, YGNodeLayoutGetLeft(root_child0));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetLeft(root_child1));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child1));
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child0));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child2));
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetLeft(root_child0_child1));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child1));
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child2));
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child1));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child2));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child2));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child2));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child2));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child2));
|
||||||
|
|
||||||
YGNodeFreeRecursive(root);
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
@@ -1832,65 +1860,80 @@ TEST(YogaTest, flex_direction_row_reverse_pos_right) {
|
|||||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||||
|
|
||||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRowReverse);
|
|
||||||
YGNodeStyleSetPosition(root, YGEdgeRight, 100);
|
|
||||||
YGNodeStyleSetWidth(root, 100);
|
YGNodeStyleSetWidth(root, 100);
|
||||||
YGNodeStyleSetHeight(root, 100);
|
YGNodeStyleSetHeight(root, 100);
|
||||||
|
|
||||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||||
YGNodeStyleSetWidth(root_child0, 10);
|
YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRowReverse);
|
||||||
|
YGNodeStyleSetPosition(root_child0, YGEdgeRight, 100);
|
||||||
|
YGNodeStyleSetWidth(root_child0, 100);
|
||||||
|
YGNodeStyleSetHeight(root_child0, 100);
|
||||||
YGNodeInsertChild(root, root_child0, 0);
|
YGNodeInsertChild(root, root_child0, 0);
|
||||||
|
|
||||||
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
|
||||||
YGNodeStyleSetWidth(root_child1, 10);
|
YGNodeStyleSetWidth(root_child0_child0, 10);
|
||||||
YGNodeInsertChild(root, root_child1, 1);
|
YGNodeInsertChild(root_child0, root_child0_child0, 0);
|
||||||
|
|
||||||
const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
|
const YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config);
|
||||||
YGNodeStyleSetWidth(root_child2, 10);
|
YGNodeStyleSetWidth(root_child0_child1, 10);
|
||||||
YGNodeInsertChild(root, root_child2, 2);
|
YGNodeInsertChild(root_child0, root_child0_child1, 1);
|
||||||
|
|
||||||
|
const YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetWidth(root_child0_child2, 10);
|
||||||
|
YGNodeInsertChild(root_child0, root_child0_child2, 2);
|
||||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(-200, YGNodeLayoutGetLeft(root));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child0));
|
ASSERT_FLOAT_EQ(-100, YGNodeLayoutGetLeft(root_child0));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetLeft(root_child1));
|
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child0_child0));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child1));
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child0));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(70, YGNodeLayoutGetLeft(root_child2));
|
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetLeft(root_child0_child1));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child1));
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child2));
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child1));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child2));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(70, YGNodeLayoutGetLeft(root_child0_child2));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child2));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child2));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child2));
|
||||||
|
|
||||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(-200, YGNodeLayoutGetLeft(root));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
ASSERT_FLOAT_EQ(-100, YGNodeLayoutGetLeft(root_child0));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetLeft(root_child1));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child1));
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child0));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child2));
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetLeft(root_child0_child1));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child1));
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child2));
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child1));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child2));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child2));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child2));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child2));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child2));
|
||||||
|
|
||||||
YGNodeFreeRecursive(root);
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
@@ -1898,71 +1941,84 @@ TEST(YogaTest, flex_direction_row_reverse_pos_right) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(YogaTest, flex_direction_row_reverse_pos_end) {
|
TEST(YogaTest, flex_direction_row_reverse_pos_end) {
|
||||||
GTEST_SKIP();
|
|
||||||
|
|
||||||
const YGConfigRef config = YGConfigNew();
|
const YGConfigRef config = YGConfigNew();
|
||||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||||
|
|
||||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRowReverse);
|
|
||||||
YGNodeStyleSetPosition(root, YGEdgeEnd, 100);
|
|
||||||
YGNodeStyleSetWidth(root, 100);
|
YGNodeStyleSetWidth(root, 100);
|
||||||
YGNodeStyleSetHeight(root, 100);
|
YGNodeStyleSetHeight(root, 100);
|
||||||
|
|
||||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||||
YGNodeStyleSetWidth(root_child0, 10);
|
YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRowReverse);
|
||||||
|
YGNodeStyleSetPosition(root_child0, YGEdgeEnd, 100);
|
||||||
|
YGNodeStyleSetWidth(root_child0, 100);
|
||||||
|
YGNodeStyleSetHeight(root_child0, 100);
|
||||||
YGNodeInsertChild(root, root_child0, 0);
|
YGNodeInsertChild(root, root_child0, 0);
|
||||||
|
|
||||||
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
|
||||||
YGNodeStyleSetWidth(root_child1, 10);
|
YGNodeStyleSetWidth(root_child0_child0, 10);
|
||||||
YGNodeInsertChild(root, root_child1, 1);
|
YGNodeInsertChild(root_child0, root_child0_child0, 0);
|
||||||
|
|
||||||
const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
|
const YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config);
|
||||||
YGNodeStyleSetWidth(root_child2, 10);
|
YGNodeStyleSetWidth(root_child0_child1, 10);
|
||||||
YGNodeInsertChild(root, root_child2, 2);
|
YGNodeInsertChild(root_child0, root_child0_child1, 1);
|
||||||
|
|
||||||
|
const YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetWidth(root_child0_child2, 10);
|
||||||
|
YGNodeInsertChild(root_child0, root_child0_child2, 2);
|
||||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(-200, YGNodeLayoutGetLeft(root));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child0));
|
ASSERT_FLOAT_EQ(-100, YGNodeLayoutGetLeft(root_child0));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetLeft(root_child1));
|
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child0_child0));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child1));
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child0));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(70, YGNodeLayoutGetLeft(root_child2));
|
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetLeft(root_child0_child1));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child1));
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child2));
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child1));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child2));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(70, YGNodeLayoutGetLeft(root_child0_child2));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child2));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child2));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child2));
|
||||||
|
|
||||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetLeft(root_child1));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child1));
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child0));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child2));
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetLeft(root_child0_child1));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child2));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child1));
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child2));
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child1));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child2));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0_child2));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child2));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child2));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child2));
|
||||||
|
|
||||||
YGNodeFreeRecursive(root);
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
@@ -1976,65 +2032,80 @@ TEST(YogaTest, flex_direction_column_reverse_pos_top) {
|
|||||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||||
|
|
||||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionColumnReverse);
|
|
||||||
YGNodeStyleSetPosition(root, YGEdgeTop, 100);
|
|
||||||
YGNodeStyleSetWidth(root, 100);
|
YGNodeStyleSetWidth(root, 100);
|
||||||
YGNodeStyleSetHeight(root, 100);
|
YGNodeStyleSetHeight(root, 100);
|
||||||
|
|
||||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||||
YGNodeStyleSetWidth(root_child0, 10);
|
YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionColumnReverse);
|
||||||
|
YGNodeStyleSetPosition(root_child0, YGEdgeTop, 100);
|
||||||
|
YGNodeStyleSetWidth(root_child0, 100);
|
||||||
|
YGNodeStyleSetHeight(root_child0, 100);
|
||||||
YGNodeInsertChild(root, root_child0, 0);
|
YGNodeInsertChild(root, root_child0, 0);
|
||||||
|
|
||||||
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
|
||||||
YGNodeStyleSetWidth(root_child1, 10);
|
YGNodeStyleSetWidth(root_child0_child0, 10);
|
||||||
YGNodeInsertChild(root, root_child1, 1);
|
YGNodeInsertChild(root_child0, root_child0_child0, 0);
|
||||||
|
|
||||||
const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
|
const YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config);
|
||||||
YGNodeStyleSetWidth(root_child2, 10);
|
YGNodeStyleSetWidth(root_child0_child1, 10);
|
||||||
YGNodeInsertChild(root, root_child2, 2);
|
YGNodeInsertChild(root_child0, root_child0_child1, 1);
|
||||||
|
|
||||||
|
const YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetWidth(root_child0_child2, 10);
|
||||||
|
YGNodeInsertChild(root_child0, root_child0_child2, 2);
|
||||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0));
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child1));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child0));
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child1));
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child0));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child1));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0_child0));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child1));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child2));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child1));
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child2));
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child1));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child2));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0_child1));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child2));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child2));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child2));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0_child2));
|
||||||
|
|
||||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child0));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0));
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child1));
|
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child0_child0));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child1));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child0));
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child1));
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child0));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child1));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0_child0));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child2));
|
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child0_child1));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child2));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child1));
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child2));
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child1));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child2));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0_child1));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child0_child2));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child2));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child2));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0_child2));
|
||||||
|
|
||||||
YGNodeFreeRecursive(root);
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
@@ -2048,65 +2119,80 @@ TEST(YogaTest, flex_direction_column_reverse_pos_bottom) {
|
|||||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, true);
|
||||||
|
|
||||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionColumnReverse);
|
|
||||||
YGNodeStyleSetPosition(root, YGEdgeBottom, 100);
|
|
||||||
YGNodeStyleSetWidth(root, 100);
|
YGNodeStyleSetWidth(root, 100);
|
||||||
YGNodeStyleSetHeight(root, 100);
|
YGNodeStyleSetHeight(root, 100);
|
||||||
|
|
||||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||||
YGNodeStyleSetWidth(root_child0, 10);
|
YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionColumnReverse);
|
||||||
|
YGNodeStyleSetPosition(root_child0, YGEdgeBottom, 100);
|
||||||
|
YGNodeStyleSetWidth(root_child0, 100);
|
||||||
|
YGNodeStyleSetHeight(root_child0, 100);
|
||||||
YGNodeInsertChild(root, root_child0, 0);
|
YGNodeInsertChild(root, root_child0, 0);
|
||||||
|
|
||||||
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
|
||||||
YGNodeStyleSetWidth(root_child1, 10);
|
YGNodeStyleSetWidth(root_child0_child0, 10);
|
||||||
YGNodeInsertChild(root, root_child1, 1);
|
YGNodeInsertChild(root_child0, root_child0_child0, 0);
|
||||||
|
|
||||||
const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
|
const YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config);
|
||||||
YGNodeStyleSetWidth(root_child2, 10);
|
YGNodeStyleSetWidth(root_child0_child1, 10);
|
||||||
YGNodeInsertChild(root, root_child2, 2);
|
YGNodeInsertChild(root_child0, root_child0_child1, 1);
|
||||||
|
|
||||||
|
const YGNodeRef root_child0_child2 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetWidth(root_child0_child2, 10);
|
||||||
|
YGNodeInsertChild(root_child0, root_child0_child2, 2);
|
||||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
ASSERT_FLOAT_EQ(-200, YGNodeLayoutGetTop(root));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0));
|
ASSERT_FLOAT_EQ(-100, YGNodeLayoutGetTop(root_child0));
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child1));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child0));
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child1));
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child0));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child1));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0_child0));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child1));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child2));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child1));
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child2));
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child1));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child2));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0_child1));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child2));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child2));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child2));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0_child2));
|
||||||
|
|
||||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
ASSERT_FLOAT_EQ(-200, YGNodeLayoutGetTop(root));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child0));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0));
|
ASSERT_FLOAT_EQ(-100, YGNodeLayoutGetTop(root_child0));
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child1));
|
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child0_child0));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child1));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child0));
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child1));
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child0));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child1));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0_child0));
|
||||||
|
|
||||||
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child2));
|
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child0_child1));
|
||||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child2));
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child1));
|
||||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child2));
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child1));
|
||||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child2));
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0_child1));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetLeft(root_child0_child2));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetTop(root_child0_child2));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetWidth(root_child0_child2));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0_child2));
|
||||||
|
|
||||||
YGNodeFreeRecursive(root);
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user