More niche box sizing tests (#1712)
Summary: Pull Request resolved: https://github.com/facebook/yoga/pull/1712 tsia, add some more advanced tests checking * percent widths/heights/padding/border * absolute positioned nodes with content box * containing block with content box + static * flex basis (fails now, needs follow up) * relative padding/border values All pass but flex basis Changelog: [Internal] Reviewed By: NickGerleman Differential Revision: D63423302 fbshipit-source-id: d117d305072e254af57eaab03a6349176e759327
This commit is contained in:
committed by
Facebook GitHub Bot
parent
671ae61a39
commit
bc236947d0
@@ -2,32 +2,85 @@
|
|||||||
style="width: 100px; height: 100px; padding: 5px; border-width: 10px; box-sizing: content-box">
|
style="width: 100px; height: 100px; padding: 5px; border-width: 10px; box-sizing: content-box">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="box_sizing_border_box"
|
<div id="box_sizing_border_box_simple"
|
||||||
style="width: 100px; height: 100px; padding: 5px; border-width: 10px; box-sizing: border-box">
|
style="width: 100px; height: 100px; padding: 5px; border-width: 10px; box-sizing: border-box">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="box_sizing_content_box_percent" style="width: 100px; height: 100px;">
|
||||||
|
<div style="width: 50%; height: 25%; padding: 4px; border-width: 16px; box-sizing: content-box">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="box_sizing_border_box_percent" style="width: 100px; height: 100px;">
|
||||||
|
<div style="width: 50%; height: 25%; padding: 4px; border-width: 16px; box-sizing: border-box">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="box_sizing_content_box_absolute" style="width: 100px; height: 100px;">
|
||||||
|
<div style="width: 50; height: 25%; padding: 12px; border-width: 8px; box-sizing: content-box; position: absolute;">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="box_sizing_border_box_absolute" style="width: 100px; height: 100px;">
|
||||||
|
<div style="width: 50; height: 25%; padding: 12px; border-width: 8px; box-sizing: border-box; position: absolute;">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="box_sizing_content_box_comtaining_block"
|
||||||
|
style="width: 100px; height: 100px; padding: 12px; border-width: 8px; box-sizing: content-box; ">
|
||||||
|
<div style="width: 75; height: 75; position: static;">
|
||||||
|
<div style="width: 50px; height: 25%; position: absolute;">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="box_sizing_border_box_comtaining_block"
|
||||||
|
style="width: 100px; height: 100px; padding: 12px; border-width: 8px; box-sizing: border-box; ">
|
||||||
|
<div style="width: 75; height: 75; position: static;">
|
||||||
|
<div style="width: 50px; height: 25%; position: absolute;">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="box_sizing_content_box_padding_only"
|
<div id="box_sizing_content_box_padding_only"
|
||||||
style="width: 100px; height: 100px; padding: 5px; box-sizing: content-box">
|
style="width: 100px; height: 100px; padding: 5px; box-sizing: content-box">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="box_sizing_border_box_padding_only"
|
<div id="box_sizing_content_box_padding_only_percent" style="width: 100px; height: 100px;">
|
||||||
style="width: 100px; height: 100px; padding: 5px; box-sizing: border-box">
|
<div style="width: 50%; height: 75; padding: 10%; box-sizing: content-box">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="box_sizing_border_box_padding_only" style="width: 100px; height: 100px; padding: 5px; box-sizing: border-box">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="box_sizing_border_box_padding_only_percent" style="width: 100px; height: 100px;">
|
||||||
|
<div style="width: 50%; height: 75; padding: 10%; box-sizing: border-box">
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="box_sizing_content_box_border_only"
|
<div id="box_sizing_content_box_border_only"
|
||||||
style="width: 100px; height: 100px; border-width: 10px; box-sizing: content-box">
|
style="width: 100px; height: 100px; border-width: 10px; box-sizing: content-box">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="box_sizing_content_box_border_only_percent" style="width: 100px; height: 100px;">
|
||||||
|
<div style="width: 50%; height: 75; border-width: 10%; box-sizing: content-box">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="box_sizing_border_box_border_only"
|
<div id="box_sizing_border_box_border_only"
|
||||||
style="width: 100px; height: 100px; border-width: 10px; box-sizing: border-box">
|
style="width: 100px; height: 100px; border-width: 10px; box-sizing: border-box">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="box_sizing_content_box_no_padding_no_border"
|
<div id="box_sizing_border_box_border_only_percent" style="width: 100px; height: 100px;">
|
||||||
style="width: 100px; height: 100px; box-sizing: content-box">
|
<div style="width: 50%; height: 75; border-width: 10%; box-sizing: border-box">
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="box_sizing_border_box_no_padding_no_border"
|
<div id="box_sizing_content_box_no_padding_no_border" style="width: 100px; height: 100px; box-sizing: content-box">
|
||||||
style="width: 100px; height: 100px; box-sizing: border-box">
|
</div>
|
||||||
|
|
||||||
|
<div id="box_sizing_border_box_no_padding_no_border" style="width: 100px; height: 100px; box-sizing: border-box">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="box_sizing_content_box_children"
|
<div id="box_sizing_content_box_children"
|
||||||
@@ -143,3 +196,55 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div data-disabled="true" id="box_sizing_content_box_flex_basis_row" style="width: 100px; height: 100px; flex-direction: row;">
|
||||||
|
<div style="flex-basis: 50px; height: 25px; padding: 5px; border-width: 10px; box-sizing: content-box">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="box_sizing_border_box_flex_basis_row" style="width: 100px; height: 100px; flex-direction: row;">
|
||||||
|
<div style="flex-basis: 50px; height: 25px; padding: 5px; border-width: 10px; box-sizing: border-box">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div data-disabled="true" id="box_sizing_content_box_flex_basis_column" style="width: 100px; height: 100px; flex-direction: column;">
|
||||||
|
<div style="flex-basis: 50px; height: 25px; padding: 5px; border-width: 10px; box-sizing: content-box">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="box_sizing_border_box_flex_basis_column" style="width: 100px; height: 100px; flex-direction: column;">
|
||||||
|
<div style="flex-basis: 50px; height: 25px; padding: 5px; border-width: 10px; box-sizing: border-box">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="box_sizing_content_box_padding_start"
|
||||||
|
style="width: 100px; height: 100px; padding-start: 5px; box-sizing: content-box">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="box_sizing_border_box_padding_start"
|
||||||
|
style="width: 100px; height: 100px; padding-start: 5px; box-sizing: border-box">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="box_sizing_content_box_padding_end"
|
||||||
|
style="width: 100px; height: 100px; padding-end: 5px; box-sizing: content-box">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="box_sizing_border_box_padding_end"
|
||||||
|
style="width: 100px; height: 100px; padding-end: 5px; box-sizing: border-box">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="box_sizing_content_box_border_start"
|
||||||
|
style="width: 100px; height: 100px; border-start-width: 5px; box-sizing: content-box">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="box_sizing_border_box_border_start"
|
||||||
|
style="width: 100px; height: 100px; border-start-width: 5px; box-sizing: border-box">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="box_sizing_content_box_border_end"
|
||||||
|
style="width: 100px; height: 100px; border-end-width: 5px; box-sizing: content-box">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="box_sizing_border_box_border_end"
|
||||||
|
style="width: 100px; height: 100px; border-end-width: 5px; box-sizing: border-box">
|
||||||
|
</div>
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*
|
*
|
||||||
* @generated SignedSource<<c57cfea6c33a34e2a67a855138e9833b>>
|
* @generated SignedSource<<80fa9cf05afc330a721a756dfaf0d1a3>>
|
||||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGBoxSizingTest.html
|
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGBoxSizingTest.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ public class YGBoxSizingTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test_box_sizing_border_box() {
|
public void test_box_sizing_border_box_simple() {
|
||||||
YogaConfig config = YogaConfigFactory.create();
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
|
|
||||||
final YogaNode root = createNode(config);
|
final YogaNode root = createNode(config);
|
||||||
@@ -94,6 +94,327 @@ public class YGBoxSizingTest {
|
|||||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_box_sizing_content_box_percent() {
|
||||||
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
|
|
||||||
|
final YogaNode root = createNode(config);
|
||||||
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||||
|
root.setWidth(100f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = createNode(config);
|
||||||
|
root_child0.setPadding(YogaEdge.LEFT, 4);
|
||||||
|
root_child0.setPadding(YogaEdge.TOP, 4);
|
||||||
|
root_child0.setPadding(YogaEdge.RIGHT, 4);
|
||||||
|
root_child0.setPadding(YogaEdge.BOTTOM, 4);
|
||||||
|
root_child0.setBorder(YogaEdge.LEFT, 16f);
|
||||||
|
root_child0.setBorder(YogaEdge.TOP, 16f);
|
||||||
|
root_child0.setBorder(YogaEdge.RIGHT, 16f);
|
||||||
|
root_child0.setBorder(YogaEdge.BOTTOM, 16f);
|
||||||
|
root_child0.setWidthPercent(50f);
|
||||||
|
root_child0.setHeightPercent(25f);
|
||||||
|
root_child0.setBoxSizing(YogaBoxSizing.CONTENT_BOX);
|
||||||
|
root.addChildAt(root_child0, 0);
|
||||||
|
root.setDirection(YogaDirection.LTR);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(90f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(65f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
root.setDirection(YogaDirection.RTL);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(10f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(90f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(65f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_box_sizing_border_box_percent() {
|
||||||
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
|
|
||||||
|
final YogaNode root = createNode(config);
|
||||||
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||||
|
root.setWidth(100f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = createNode(config);
|
||||||
|
root_child0.setPadding(YogaEdge.LEFT, 4);
|
||||||
|
root_child0.setPadding(YogaEdge.TOP, 4);
|
||||||
|
root_child0.setPadding(YogaEdge.RIGHT, 4);
|
||||||
|
root_child0.setPadding(YogaEdge.BOTTOM, 4);
|
||||||
|
root_child0.setBorder(YogaEdge.LEFT, 16f);
|
||||||
|
root_child0.setBorder(YogaEdge.TOP, 16f);
|
||||||
|
root_child0.setBorder(YogaEdge.RIGHT, 16f);
|
||||||
|
root_child0.setBorder(YogaEdge.BOTTOM, 16f);
|
||||||
|
root_child0.setWidthPercent(50f);
|
||||||
|
root_child0.setHeightPercent(25f);
|
||||||
|
root.addChildAt(root_child0, 0);
|
||||||
|
root.setDirection(YogaDirection.LTR);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(40f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
root.setDirection(YogaDirection.RTL);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(40f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_box_sizing_content_box_absolute() {
|
||||||
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
|
|
||||||
|
final YogaNode root = createNode(config);
|
||||||
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||||
|
root.setWidth(100f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = createNode(config);
|
||||||
|
root_child0.setPositionType(YogaPositionType.ABSOLUTE);
|
||||||
|
root_child0.setPadding(YogaEdge.LEFT, 12);
|
||||||
|
root_child0.setPadding(YogaEdge.TOP, 12);
|
||||||
|
root_child0.setPadding(YogaEdge.RIGHT, 12);
|
||||||
|
root_child0.setPadding(YogaEdge.BOTTOM, 12);
|
||||||
|
root_child0.setBorder(YogaEdge.LEFT, 8f);
|
||||||
|
root_child0.setBorder(YogaEdge.TOP, 8f);
|
||||||
|
root_child0.setBorder(YogaEdge.RIGHT, 8f);
|
||||||
|
root_child0.setBorder(YogaEdge.BOTTOM, 8f);
|
||||||
|
root_child0.setHeightPercent(25f);
|
||||||
|
root_child0.setBoxSizing(YogaBoxSizing.CONTENT_BOX);
|
||||||
|
root.addChildAt(root_child0, 0);
|
||||||
|
root.setDirection(YogaDirection.LTR);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(40f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(65f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
root.setDirection(YogaDirection.RTL);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(60f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(40f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(65f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_box_sizing_border_box_absolute() {
|
||||||
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
|
|
||||||
|
final YogaNode root = createNode(config);
|
||||||
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||||
|
root.setWidth(100f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = createNode(config);
|
||||||
|
root_child0.setPositionType(YogaPositionType.ABSOLUTE);
|
||||||
|
root_child0.setPadding(YogaEdge.LEFT, 12);
|
||||||
|
root_child0.setPadding(YogaEdge.TOP, 12);
|
||||||
|
root_child0.setPadding(YogaEdge.RIGHT, 12);
|
||||||
|
root_child0.setPadding(YogaEdge.BOTTOM, 12);
|
||||||
|
root_child0.setBorder(YogaEdge.LEFT, 8f);
|
||||||
|
root_child0.setBorder(YogaEdge.TOP, 8f);
|
||||||
|
root_child0.setBorder(YogaEdge.RIGHT, 8f);
|
||||||
|
root_child0.setBorder(YogaEdge.BOTTOM, 8f);
|
||||||
|
root_child0.setHeightPercent(25f);
|
||||||
|
root.addChildAt(root_child0, 0);
|
||||||
|
root.setDirection(YogaDirection.LTR);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(40f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(40f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
root.setDirection(YogaDirection.RTL);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(60f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(40f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(40f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_box_sizing_content_box_comtaining_block() {
|
||||||
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
|
|
||||||
|
final YogaNode root = createNode(config);
|
||||||
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||||
|
root.setPadding(YogaEdge.LEFT, 12);
|
||||||
|
root.setPadding(YogaEdge.TOP, 12);
|
||||||
|
root.setPadding(YogaEdge.RIGHT, 12);
|
||||||
|
root.setPadding(YogaEdge.BOTTOM, 12);
|
||||||
|
root.setBorder(YogaEdge.LEFT, 8f);
|
||||||
|
root.setBorder(YogaEdge.TOP, 8f);
|
||||||
|
root.setBorder(YogaEdge.RIGHT, 8f);
|
||||||
|
root.setBorder(YogaEdge.BOTTOM, 8f);
|
||||||
|
root.setWidth(100f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
root.setBoxSizing(YogaBoxSizing.CONTENT_BOX);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = createNode(config);
|
||||||
|
root_child0.setPositionType(YogaPositionType.STATIC);
|
||||||
|
root.addChildAt(root_child0, 0);
|
||||||
|
|
||||||
|
final YogaNode root_child0_child0 = createNode(config);
|
||||||
|
root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
|
||||||
|
root_child0_child0.setWidth(50f);
|
||||||
|
root_child0_child0.setHeightPercent(25f);
|
||||||
|
root_child0.addChildAt(root_child0_child0, 0);
|
||||||
|
root.setDirection(YogaDirection.LTR);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(140f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(140f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(20f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(20f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(31f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
root.setDirection(YogaDirection.RTL);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(140f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(140f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(20f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(20f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(50f, root_child0_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(31f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_box_sizing_border_box_comtaining_block() {
|
||||||
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
|
|
||||||
|
final YogaNode root = createNode(config);
|
||||||
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||||
|
root.setPadding(YogaEdge.LEFT, 12);
|
||||||
|
root.setPadding(YogaEdge.TOP, 12);
|
||||||
|
root.setPadding(YogaEdge.RIGHT, 12);
|
||||||
|
root.setPadding(YogaEdge.BOTTOM, 12);
|
||||||
|
root.setBorder(YogaEdge.LEFT, 8f);
|
||||||
|
root.setBorder(YogaEdge.TOP, 8f);
|
||||||
|
root.setBorder(YogaEdge.RIGHT, 8f);
|
||||||
|
root.setBorder(YogaEdge.BOTTOM, 8f);
|
||||||
|
root.setWidth(100f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = createNode(config);
|
||||||
|
root_child0.setPositionType(YogaPositionType.STATIC);
|
||||||
|
root.addChildAt(root_child0, 0);
|
||||||
|
|
||||||
|
final YogaNode root_child0_child0 = createNode(config);
|
||||||
|
root_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
|
||||||
|
root_child0_child0.setWidth(50f);
|
||||||
|
root_child0_child0.setHeightPercent(25f);
|
||||||
|
root_child0.addChildAt(root_child0_child0, 0);
|
||||||
|
root.setDirection(YogaDirection.LTR);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(20f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(20f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(60f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(21f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
root.setDirection(YogaDirection.RTL);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(20f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(20f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(60f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(10f, root_child0_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(50f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(21f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test_box_sizing_content_box_padding_only() {
|
public void test_box_sizing_content_box_padding_only() {
|
||||||
YogaConfig config = YogaConfigFactory.create();
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
@@ -124,6 +445,50 @@ public class YGBoxSizingTest {
|
|||||||
assertEquals(110f, root.getLayoutHeight(), 0.0f);
|
assertEquals(110f, root.getLayoutHeight(), 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_box_sizing_content_box_padding_only_percent() {
|
||||||
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
|
|
||||||
|
final YogaNode root = createNode(config);
|
||||||
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||||
|
root.setWidth(100f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = createNode(config);
|
||||||
|
root_child0.setPaddingPercent(YogaEdge.LEFT, 10);
|
||||||
|
root_child0.setPaddingPercent(YogaEdge.TOP, 10);
|
||||||
|
root_child0.setPaddingPercent(YogaEdge.RIGHT, 10);
|
||||||
|
root_child0.setPaddingPercent(YogaEdge.BOTTOM, 10);
|
||||||
|
root_child0.setWidthPercent(50f);
|
||||||
|
root_child0.setBoxSizing(YogaBoxSizing.CONTENT_BOX);
|
||||||
|
root.addChildAt(root_child0, 0);
|
||||||
|
root.setDirection(YogaDirection.LTR);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(70f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(20f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
root.setDirection(YogaDirection.RTL);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(30f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(70f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(20f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test_box_sizing_border_box_padding_only() {
|
public void test_box_sizing_border_box_padding_only() {
|
||||||
YogaConfig config = YogaConfigFactory.create();
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
@@ -153,6 +518,49 @@ public class YGBoxSizingTest {
|
|||||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_box_sizing_border_box_padding_only_percent() {
|
||||||
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
|
|
||||||
|
final YogaNode root = createNode(config);
|
||||||
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||||
|
root.setWidth(100f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = createNode(config);
|
||||||
|
root_child0.setPaddingPercent(YogaEdge.LEFT, 10);
|
||||||
|
root_child0.setPaddingPercent(YogaEdge.TOP, 10);
|
||||||
|
root_child0.setPaddingPercent(YogaEdge.RIGHT, 10);
|
||||||
|
root_child0.setPaddingPercent(YogaEdge.BOTTOM, 10);
|
||||||
|
root_child0.setWidthPercent(50f);
|
||||||
|
root.addChildAt(root_child0, 0);
|
||||||
|
root.setDirection(YogaDirection.LTR);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(20f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
root.setDirection(YogaDirection.RTL);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(20f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test_box_sizing_content_box_border_only() {
|
public void test_box_sizing_content_box_border_only() {
|
||||||
YogaConfig config = YogaConfigFactory.create();
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
@@ -183,6 +591,46 @@ public class YGBoxSizingTest {
|
|||||||
assertEquals(120f, root.getLayoutHeight(), 0.0f);
|
assertEquals(120f, root.getLayoutHeight(), 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_box_sizing_content_box_border_only_percent() {
|
||||||
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
|
|
||||||
|
final YogaNode root = createNode(config);
|
||||||
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||||
|
root.setWidth(100f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = createNode(config);
|
||||||
|
root_child0.setWidthPercent(50f);
|
||||||
|
root_child0.setBoxSizing(YogaBoxSizing.CONTENT_BOX);
|
||||||
|
root.addChildAt(root_child0, 0);
|
||||||
|
root.setDirection(YogaDirection.LTR);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
root.setDirection(YogaDirection.RTL);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test_box_sizing_border_box_border_only() {
|
public void test_box_sizing_border_box_border_only() {
|
||||||
YogaConfig config = YogaConfigFactory.create();
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
@@ -212,6 +660,45 @@ public class YGBoxSizingTest {
|
|||||||
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_box_sizing_border_box_border_only_percent() {
|
||||||
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
|
|
||||||
|
final YogaNode root = createNode(config);
|
||||||
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||||
|
root.setWidth(100f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = createNode(config);
|
||||||
|
root_child0.setWidthPercent(50f);
|
||||||
|
root.addChildAt(root_child0, 0);
|
||||||
|
root.setDirection(YogaDirection.LTR);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
root.setDirection(YogaDirection.RTL);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test_box_sizing_content_box_no_padding_no_border() {
|
public void test_box_sizing_content_box_no_padding_no_border() {
|
||||||
YogaConfig config = YogaConfigFactory.create();
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
@@ -1607,6 +2094,416 @@ public class YGBoxSizingTest {
|
|||||||
assertEquals(9f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
|
assertEquals(9f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Ignore
|
||||||
|
public void test_box_sizing_content_box_flex_basis_row() {
|
||||||
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
|
|
||||||
|
final YogaNode root = createNode(config);
|
||||||
|
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||||
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||||
|
root.setWidth(100f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = createNode(config);
|
||||||
|
root_child0.setFlexBasis(50f);
|
||||||
|
root_child0.setPadding(YogaEdge.LEFT, 5);
|
||||||
|
root_child0.setPadding(YogaEdge.TOP, 5);
|
||||||
|
root_child0.setPadding(YogaEdge.RIGHT, 5);
|
||||||
|
root_child0.setPadding(YogaEdge.BOTTOM, 5);
|
||||||
|
root_child0.setBorder(YogaEdge.LEFT, 10f);
|
||||||
|
root_child0.setBorder(YogaEdge.TOP, 10f);
|
||||||
|
root_child0.setBorder(YogaEdge.RIGHT, 10f);
|
||||||
|
root_child0.setBorder(YogaEdge.BOTTOM, 10f);
|
||||||
|
root_child0.setHeight(25f);
|
||||||
|
root_child0.setBoxSizing(YogaBoxSizing.CONTENT_BOX);
|
||||||
|
root.addChildAt(root_child0, 0);
|
||||||
|
root.setDirection(YogaDirection.LTR);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(80f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(55f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
root.setDirection(YogaDirection.RTL);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(20f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(80f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(55f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_box_sizing_border_box_flex_basis_row() {
|
||||||
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
|
|
||||||
|
final YogaNode root = createNode(config);
|
||||||
|
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||||
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||||
|
root.setWidth(100f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = createNode(config);
|
||||||
|
root_child0.setFlexBasis(50f);
|
||||||
|
root_child0.setPadding(YogaEdge.LEFT, 5);
|
||||||
|
root_child0.setPadding(YogaEdge.TOP, 5);
|
||||||
|
root_child0.setPadding(YogaEdge.RIGHT, 5);
|
||||||
|
root_child0.setPadding(YogaEdge.BOTTOM, 5);
|
||||||
|
root_child0.setBorder(YogaEdge.LEFT, 10f);
|
||||||
|
root_child0.setBorder(YogaEdge.TOP, 10f);
|
||||||
|
root_child0.setBorder(YogaEdge.RIGHT, 10f);
|
||||||
|
root_child0.setBorder(YogaEdge.BOTTOM, 10f);
|
||||||
|
root_child0.setHeight(25f);
|
||||||
|
root.addChildAt(root_child0, 0);
|
||||||
|
root.setDirection(YogaDirection.LTR);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(30f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
root.setDirection(YogaDirection.RTL);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(30f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Ignore
|
||||||
|
public void test_box_sizing_content_box_flex_basis_column() {
|
||||||
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
|
|
||||||
|
final YogaNode root = createNode(config);
|
||||||
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||||
|
root.setWidth(100f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = createNode(config);
|
||||||
|
root_child0.setFlexBasis(50f);
|
||||||
|
root_child0.setPadding(YogaEdge.LEFT, 5);
|
||||||
|
root_child0.setPadding(YogaEdge.TOP, 5);
|
||||||
|
root_child0.setPadding(YogaEdge.RIGHT, 5);
|
||||||
|
root_child0.setPadding(YogaEdge.BOTTOM, 5);
|
||||||
|
root_child0.setBorder(YogaEdge.LEFT, 10f);
|
||||||
|
root_child0.setBorder(YogaEdge.TOP, 10f);
|
||||||
|
root_child0.setBorder(YogaEdge.RIGHT, 10f);
|
||||||
|
root_child0.setBorder(YogaEdge.BOTTOM, 10f);
|
||||||
|
root_child0.setHeight(25f);
|
||||||
|
root_child0.setBoxSizing(YogaBoxSizing.CONTENT_BOX);
|
||||||
|
root.addChildAt(root_child0, 0);
|
||||||
|
root.setDirection(YogaDirection.LTR);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(80f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
root.setDirection(YogaDirection.RTL);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(80f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_box_sizing_border_box_flex_basis_column() {
|
||||||
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
|
|
||||||
|
final YogaNode root = createNode(config);
|
||||||
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||||
|
root.setWidth(100f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = createNode(config);
|
||||||
|
root_child0.setFlexBasis(50f);
|
||||||
|
root_child0.setPadding(YogaEdge.LEFT, 5);
|
||||||
|
root_child0.setPadding(YogaEdge.TOP, 5);
|
||||||
|
root_child0.setPadding(YogaEdge.RIGHT, 5);
|
||||||
|
root_child0.setPadding(YogaEdge.BOTTOM, 5);
|
||||||
|
root_child0.setBorder(YogaEdge.LEFT, 10f);
|
||||||
|
root_child0.setBorder(YogaEdge.TOP, 10f);
|
||||||
|
root_child0.setBorder(YogaEdge.RIGHT, 10f);
|
||||||
|
root_child0.setBorder(YogaEdge.BOTTOM, 10f);
|
||||||
|
root_child0.setHeight(25f);
|
||||||
|
root.addChildAt(root_child0, 0);
|
||||||
|
root.setDirection(YogaDirection.LTR);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
root.setDirection(YogaDirection.RTL);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_box_sizing_content_box_padding_start() {
|
||||||
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
|
|
||||||
|
final YogaNode root = createNode(config);
|
||||||
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||||
|
root.setPadding(YogaEdge.START, 5);
|
||||||
|
root.setWidth(100f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
root.setBoxSizing(YogaBoxSizing.CONTENT_BOX);
|
||||||
|
root.setDirection(YogaDirection.LTR);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(105f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
root.setDirection(YogaDirection.RTL);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(105f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_box_sizing_border_box_padding_start() {
|
||||||
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
|
|
||||||
|
final YogaNode root = createNode(config);
|
||||||
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||||
|
root.setPadding(YogaEdge.START, 5);
|
||||||
|
root.setWidth(100f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
root.setDirection(YogaDirection.LTR);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
root.setDirection(YogaDirection.RTL);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_box_sizing_content_box_padding_end() {
|
||||||
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
|
|
||||||
|
final YogaNode root = createNode(config);
|
||||||
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||||
|
root.setPadding(YogaEdge.END, 5);
|
||||||
|
root.setWidth(100f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
root.setBoxSizing(YogaBoxSizing.CONTENT_BOX);
|
||||||
|
root.setDirection(YogaDirection.LTR);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(105f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
root.setDirection(YogaDirection.RTL);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(105f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_box_sizing_border_box_padding_end() {
|
||||||
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
|
|
||||||
|
final YogaNode root = createNode(config);
|
||||||
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||||
|
root.setPadding(YogaEdge.END, 5);
|
||||||
|
root.setWidth(100f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
root.setDirection(YogaDirection.LTR);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
root.setDirection(YogaDirection.RTL);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_box_sizing_content_box_border_start() {
|
||||||
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
|
|
||||||
|
final YogaNode root = createNode(config);
|
||||||
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||||
|
root.setBorder(YogaEdge.START, 5f);
|
||||||
|
root.setWidth(100f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
root.setBoxSizing(YogaBoxSizing.CONTENT_BOX);
|
||||||
|
root.setDirection(YogaDirection.LTR);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(105f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
root.setDirection(YogaDirection.RTL);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(105f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_box_sizing_border_box_border_start() {
|
||||||
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
|
|
||||||
|
final YogaNode root = createNode(config);
|
||||||
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||||
|
root.setBorder(YogaEdge.START, 5f);
|
||||||
|
root.setWidth(100f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
root.setDirection(YogaDirection.LTR);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
root.setDirection(YogaDirection.RTL);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_box_sizing_content_box_border_end() {
|
||||||
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
|
|
||||||
|
final YogaNode root = createNode(config);
|
||||||
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||||
|
root.setBorder(YogaEdge.END, 5f);
|
||||||
|
root.setWidth(100f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
root.setBoxSizing(YogaBoxSizing.CONTENT_BOX);
|
||||||
|
root.setDirection(YogaDirection.LTR);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(105f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
root.setDirection(YogaDirection.RTL);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(105f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_box_sizing_border_box_border_end() {
|
||||||
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
|
|
||||||
|
final YogaNode root = createNode(config);
|
||||||
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||||
|
root.setBorder(YogaEdge.END, 5f);
|
||||||
|
root.setWidth(100f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
root.setDirection(YogaDirection.LTR);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
root.setDirection(YogaDirection.RTL);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
private YogaNode createNode(YogaConfig config) {
|
private YogaNode createNode(YogaConfig config) {
|
||||||
return mNodeFactory.create(config);
|
return mNodeFactory.create(config);
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -899,3 +899,81 @@ TEST(YogaTest, percent_padding_and_percent_margin_with_measure_func) {
|
|||||||
|
|
||||||
YGConfigFree(config);
|
YGConfigFree(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static YGSize _measure_half_width_height(
|
||||||
|
YGNodeConstRef node,
|
||||||
|
float width,
|
||||||
|
YGMeasureMode /*widthMode*/,
|
||||||
|
float height,
|
||||||
|
YGMeasureMode /*heightMode*/) {
|
||||||
|
int* measureCount = (int*)YGNodeGetContext(node);
|
||||||
|
if (measureCount != nullptr) {
|
||||||
|
(*measureCount)++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return YGSize{0.5f * width, 0.5f * height};
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, measure_content_box) {
|
||||||
|
YGNodeRef root = YGNodeNew();
|
||||||
|
YGNodeStyleSetWidth(root, 100);
|
||||||
|
YGNodeStyleSetHeight(root, 200);
|
||||||
|
YGNodeStyleSetBoxSizing(root, YGBoxSizingContentBox);
|
||||||
|
YGNodeStyleSetPadding(root, YGEdgeAll, 5);
|
||||||
|
YGNodeStyleSetBorder(root, YGEdgeAll, 10);
|
||||||
|
|
||||||
|
int measureCount = 0;
|
||||||
|
|
||||||
|
YGNodeRef root_child0 = YGNodeNew();
|
||||||
|
YGNodeSetContext(root_child0, &measureCount);
|
||||||
|
YGNodeSetMeasureFunc(root_child0, _measure_half_width_height);
|
||||||
|
YGNodeInsertChild(root, root_child0, 0);
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
|
ASSERT_EQ(1, measureCount);
|
||||||
|
|
||||||
|
ASSERT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_EQ(130, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_EQ(230, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_EQ(15, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_EQ(15, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_EQ(100, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
YGNodeFreeRecursive(root);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, measure_border_box) {
|
||||||
|
YGNodeRef root = YGNodeNew();
|
||||||
|
YGNodeStyleSetWidth(root, 100);
|
||||||
|
YGNodeStyleSetHeight(root, 200);
|
||||||
|
YGNodeStyleSetBoxSizing(root, YGBoxSizingBorderBox);
|
||||||
|
YGNodeStyleSetPadding(root, YGEdgeAll, 5);
|
||||||
|
YGNodeStyleSetBorder(root, YGEdgeAll, 10);
|
||||||
|
|
||||||
|
int measureCount = 0;
|
||||||
|
|
||||||
|
YGNodeRef root_child0 = YGNodeNew();
|
||||||
|
YGNodeSetContext(root_child0, &measureCount);
|
||||||
|
YGNodeSetMeasureFunc(root_child0, _measure_half_width_height);
|
||||||
|
YGNodeInsertChild(root, root_child0, 0);
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
|
ASSERT_EQ(1, measureCount);
|
||||||
|
|
||||||
|
ASSERT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_EQ(200, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_EQ(15, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_EQ(15, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_EQ(70, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_EQ(85, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
YGNodeFreeRecursive(root);
|
||||||
|
}
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*
|
*
|
||||||
* clang-format off
|
* clang-format off
|
||||||
* @generated SignedSource<<56d0eec106ade0bbd034067594249c76>>
|
* @generated SignedSource<<36f0f519320608e2c5c6eb6666be7efc>>
|
||||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGBoxSizingTest.html
|
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGBoxSizingTest.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ TEST(YogaTest, box_sizing_content_box_simple) {
|
|||||||
YGConfigFree(config);
|
YGConfigFree(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(YogaTest, box_sizing_border_box) {
|
TEST(YogaTest, box_sizing_border_box_simple) {
|
||||||
YGConfigRef config = YGConfigNew();
|
YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
YGNodeRef root = YGNodeNewWithConfig(config);
|
YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
@@ -82,6 +82,333 @@ TEST(YogaTest, box_sizing_border_box) {
|
|||||||
YGConfigFree(config);
|
YGConfigFree(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, box_sizing_content_box_percent) {
|
||||||
|
YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
|
YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||||
|
YGNodeStyleSetWidth(root, 100);
|
||||||
|
YGNodeStyleSetHeight(root, 100);
|
||||||
|
|
||||||
|
YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetPadding(root_child0, YGEdgeLeft, 4);
|
||||||
|
YGNodeStyleSetPadding(root_child0, YGEdgeTop, 4);
|
||||||
|
YGNodeStyleSetPadding(root_child0, YGEdgeRight, 4);
|
||||||
|
YGNodeStyleSetPadding(root_child0, YGEdgeBottom, 4);
|
||||||
|
YGNodeStyleSetBorder(root_child0, YGEdgeLeft, 16);
|
||||||
|
YGNodeStyleSetBorder(root_child0, YGEdgeTop, 16);
|
||||||
|
YGNodeStyleSetBorder(root_child0, YGEdgeRight, 16);
|
||||||
|
YGNodeStyleSetBorder(root_child0, YGEdgeBottom, 16);
|
||||||
|
YGNodeStyleSetWidthPercent(root_child0, 50);
|
||||||
|
YGNodeStyleSetHeightPercent(root_child0, 25);
|
||||||
|
YGNodeStyleSetBoxSizing(root_child0, YGBoxSizingContentBox);
|
||||||
|
YGNodeInsertChild(root, root_child0, 0);
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(65, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(90, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(65, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
|
YGConfigFree(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, box_sizing_border_box_percent) {
|
||||||
|
YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
|
YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||||
|
YGNodeStyleSetWidth(root, 100);
|
||||||
|
YGNodeStyleSetHeight(root, 100);
|
||||||
|
|
||||||
|
YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetPadding(root_child0, YGEdgeLeft, 4);
|
||||||
|
YGNodeStyleSetPadding(root_child0, YGEdgeTop, 4);
|
||||||
|
YGNodeStyleSetPadding(root_child0, YGEdgeRight, 4);
|
||||||
|
YGNodeStyleSetPadding(root_child0, YGEdgeBottom, 4);
|
||||||
|
YGNodeStyleSetBorder(root_child0, YGEdgeLeft, 16);
|
||||||
|
YGNodeStyleSetBorder(root_child0, YGEdgeTop, 16);
|
||||||
|
YGNodeStyleSetBorder(root_child0, YGEdgeRight, 16);
|
||||||
|
YGNodeStyleSetBorder(root_child0, YGEdgeBottom, 16);
|
||||||
|
YGNodeStyleSetWidthPercent(root_child0, 50);
|
||||||
|
YGNodeStyleSetHeightPercent(root_child0, 25);
|
||||||
|
YGNodeInsertChild(root, root_child0, 0);
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
|
YGConfigFree(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, box_sizing_content_box_absolute) {
|
||||||
|
YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
|
YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||||
|
YGNodeStyleSetWidth(root, 100);
|
||||||
|
YGNodeStyleSetHeight(root, 100);
|
||||||
|
|
||||||
|
YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
|
||||||
|
YGNodeStyleSetPadding(root_child0, YGEdgeLeft, 12);
|
||||||
|
YGNodeStyleSetPadding(root_child0, YGEdgeTop, 12);
|
||||||
|
YGNodeStyleSetPadding(root_child0, YGEdgeRight, 12);
|
||||||
|
YGNodeStyleSetPadding(root_child0, YGEdgeBottom, 12);
|
||||||
|
YGNodeStyleSetBorder(root_child0, YGEdgeLeft, 8);
|
||||||
|
YGNodeStyleSetBorder(root_child0, YGEdgeTop, 8);
|
||||||
|
YGNodeStyleSetBorder(root_child0, YGEdgeRight, 8);
|
||||||
|
YGNodeStyleSetBorder(root_child0, YGEdgeBottom, 8);
|
||||||
|
YGNodeStyleSetHeightPercent(root_child0, 25);
|
||||||
|
YGNodeStyleSetBoxSizing(root_child0, YGBoxSizingContentBox);
|
||||||
|
YGNodeInsertChild(root, root_child0, 0);
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(65, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(65, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
|
YGConfigFree(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, box_sizing_border_box_absolute) {
|
||||||
|
YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
|
YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||||
|
YGNodeStyleSetWidth(root, 100);
|
||||||
|
YGNodeStyleSetHeight(root, 100);
|
||||||
|
|
||||||
|
YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetPositionType(root_child0, YGPositionTypeAbsolute);
|
||||||
|
YGNodeStyleSetPadding(root_child0, YGEdgeLeft, 12);
|
||||||
|
YGNodeStyleSetPadding(root_child0, YGEdgeTop, 12);
|
||||||
|
YGNodeStyleSetPadding(root_child0, YGEdgeRight, 12);
|
||||||
|
YGNodeStyleSetPadding(root_child0, YGEdgeBottom, 12);
|
||||||
|
YGNodeStyleSetBorder(root_child0, YGEdgeLeft, 8);
|
||||||
|
YGNodeStyleSetBorder(root_child0, YGEdgeTop, 8);
|
||||||
|
YGNodeStyleSetBorder(root_child0, YGEdgeRight, 8);
|
||||||
|
YGNodeStyleSetBorder(root_child0, YGEdgeBottom, 8);
|
||||||
|
YGNodeStyleSetHeightPercent(root_child0, 25);
|
||||||
|
YGNodeInsertChild(root, root_child0, 0);
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
|
YGConfigFree(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, box_sizing_content_box_comtaining_block) {
|
||||||
|
YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
|
YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||||
|
YGNodeStyleSetPadding(root, YGEdgeLeft, 12);
|
||||||
|
YGNodeStyleSetPadding(root, YGEdgeTop, 12);
|
||||||
|
YGNodeStyleSetPadding(root, YGEdgeRight, 12);
|
||||||
|
YGNodeStyleSetPadding(root, YGEdgeBottom, 12);
|
||||||
|
YGNodeStyleSetBorder(root, YGEdgeLeft, 8);
|
||||||
|
YGNodeStyleSetBorder(root, YGEdgeTop, 8);
|
||||||
|
YGNodeStyleSetBorder(root, YGEdgeRight, 8);
|
||||||
|
YGNodeStyleSetBorder(root, YGEdgeBottom, 8);
|
||||||
|
YGNodeStyleSetWidth(root, 100);
|
||||||
|
YGNodeStyleSetHeight(root, 100);
|
||||||
|
YGNodeStyleSetBoxSizing(root, YGBoxSizingContentBox);
|
||||||
|
|
||||||
|
YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetPositionType(root_child0, YGPositionTypeStatic);
|
||||||
|
YGNodeInsertChild(root, root_child0, 0);
|
||||||
|
|
||||||
|
YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeAbsolute);
|
||||||
|
YGNodeStyleSetWidth(root_child0_child0, 50);
|
||||||
|
YGNodeStyleSetHeightPercent(root_child0_child0, 25);
|
||||||
|
YGNodeInsertChild(root_child0, root_child0_child0, 0);
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(140, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(140, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(31, YGNodeLayoutGetHeight(root_child0_child0));
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(140, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(140, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(31, YGNodeLayoutGetHeight(root_child0_child0));
|
||||||
|
|
||||||
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
|
YGConfigFree(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, box_sizing_border_box_comtaining_block) {
|
||||||
|
YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
|
YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||||
|
YGNodeStyleSetPadding(root, YGEdgeLeft, 12);
|
||||||
|
YGNodeStyleSetPadding(root, YGEdgeTop, 12);
|
||||||
|
YGNodeStyleSetPadding(root, YGEdgeRight, 12);
|
||||||
|
YGNodeStyleSetPadding(root, YGEdgeBottom, 12);
|
||||||
|
YGNodeStyleSetBorder(root, YGEdgeLeft, 8);
|
||||||
|
YGNodeStyleSetBorder(root, YGEdgeTop, 8);
|
||||||
|
YGNodeStyleSetBorder(root, YGEdgeRight, 8);
|
||||||
|
YGNodeStyleSetBorder(root, YGEdgeBottom, 8);
|
||||||
|
YGNodeStyleSetWidth(root, 100);
|
||||||
|
YGNodeStyleSetHeight(root, 100);
|
||||||
|
|
||||||
|
YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetPositionType(root_child0, YGPositionTypeStatic);
|
||||||
|
YGNodeInsertChild(root, root_child0, 0);
|
||||||
|
|
||||||
|
YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeAbsolute);
|
||||||
|
YGNodeStyleSetWidth(root_child0_child0, 50);
|
||||||
|
YGNodeStyleSetHeightPercent(root_child0_child0, 25);
|
||||||
|
YGNodeInsertChild(root_child0, root_child0_child0, 0);
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(21, YGNodeLayoutGetHeight(root_child0_child0));
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetLeft(root_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(21, YGNodeLayoutGetHeight(root_child0_child0));
|
||||||
|
|
||||||
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
|
YGConfigFree(config);
|
||||||
|
}
|
||||||
|
|
||||||
TEST(YogaTest, box_sizing_content_box_padding_only) {
|
TEST(YogaTest, box_sizing_content_box_padding_only) {
|
||||||
YGConfigRef config = YGConfigNew();
|
YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
@@ -113,6 +440,51 @@ TEST(YogaTest, box_sizing_content_box_padding_only) {
|
|||||||
YGConfigFree(config);
|
YGConfigFree(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, box_sizing_content_box_padding_only_percent) {
|
||||||
|
YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
|
YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||||
|
YGNodeStyleSetWidth(root, 100);
|
||||||
|
YGNodeStyleSetHeight(root, 100);
|
||||||
|
|
||||||
|
YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetPaddingPercent(root_child0, YGEdgeLeft, 10);
|
||||||
|
YGNodeStyleSetPaddingPercent(root_child0, YGEdgeTop, 10);
|
||||||
|
YGNodeStyleSetPaddingPercent(root_child0, YGEdgeRight, 10);
|
||||||
|
YGNodeStyleSetPaddingPercent(root_child0, YGEdgeBottom, 10);
|
||||||
|
YGNodeStyleSetWidthPercent(root_child0, 50);
|
||||||
|
YGNodeStyleSetBoxSizing(root_child0, YGBoxSizingContentBox);
|
||||||
|
YGNodeInsertChild(root, root_child0, 0);
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(70, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(70, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
|
YGConfigFree(config);
|
||||||
|
}
|
||||||
|
|
||||||
TEST(YogaTest, box_sizing_border_box_padding_only) {
|
TEST(YogaTest, box_sizing_border_box_padding_only) {
|
||||||
YGConfigRef config = YGConfigNew();
|
YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
@@ -143,6 +515,50 @@ TEST(YogaTest, box_sizing_border_box_padding_only) {
|
|||||||
YGConfigFree(config);
|
YGConfigFree(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, box_sizing_border_box_padding_only_percent) {
|
||||||
|
YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
|
YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||||
|
YGNodeStyleSetWidth(root, 100);
|
||||||
|
YGNodeStyleSetHeight(root, 100);
|
||||||
|
|
||||||
|
YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetPaddingPercent(root_child0, YGEdgeLeft, 10);
|
||||||
|
YGNodeStyleSetPaddingPercent(root_child0, YGEdgeTop, 10);
|
||||||
|
YGNodeStyleSetPaddingPercent(root_child0, YGEdgeRight, 10);
|
||||||
|
YGNodeStyleSetPaddingPercent(root_child0, YGEdgeBottom, 10);
|
||||||
|
YGNodeStyleSetWidthPercent(root_child0, 50);
|
||||||
|
YGNodeInsertChild(root, root_child0, 0);
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
|
YGConfigFree(config);
|
||||||
|
}
|
||||||
|
|
||||||
TEST(YogaTest, box_sizing_content_box_border_only) {
|
TEST(YogaTest, box_sizing_content_box_border_only) {
|
||||||
YGConfigRef config = YGConfigNew();
|
YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
@@ -174,6 +590,47 @@ TEST(YogaTest, box_sizing_content_box_border_only) {
|
|||||||
YGConfigFree(config);
|
YGConfigFree(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, box_sizing_content_box_border_only_percent) {
|
||||||
|
YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
|
YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||||
|
YGNodeStyleSetWidth(root, 100);
|
||||||
|
YGNodeStyleSetHeight(root, 100);
|
||||||
|
|
||||||
|
YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetWidthPercent(root_child0, 50);
|
||||||
|
YGNodeStyleSetBoxSizing(root_child0, YGBoxSizingContentBox);
|
||||||
|
YGNodeInsertChild(root, root_child0, 0);
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
|
YGConfigFree(config);
|
||||||
|
}
|
||||||
|
|
||||||
TEST(YogaTest, box_sizing_border_box_border_only) {
|
TEST(YogaTest, box_sizing_border_box_border_only) {
|
||||||
YGConfigRef config = YGConfigNew();
|
YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
@@ -204,6 +661,46 @@ TEST(YogaTest, box_sizing_border_box_border_only) {
|
|||||||
YGConfigFree(config);
|
YGConfigFree(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, box_sizing_border_box_border_only_percent) {
|
||||||
|
YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
|
YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||||
|
YGNodeStyleSetWidth(root, 100);
|
||||||
|
YGNodeStyleSetHeight(root, 100);
|
||||||
|
|
||||||
|
YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetWidthPercent(root_child0, 50);
|
||||||
|
YGNodeInsertChild(root, root_child0, 0);
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
|
YGConfigFree(config);
|
||||||
|
}
|
||||||
|
|
||||||
TEST(YogaTest, box_sizing_content_box_no_padding_no_border) {
|
TEST(YogaTest, box_sizing_content_box_no_padding_no_border) {
|
||||||
YGConfigRef config = YGConfigNew();
|
YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
@@ -1618,3 +2115,427 @@ TEST(YogaTest, box_sizing_border_box_nested_alternating) {
|
|||||||
|
|
||||||
YGConfigFree(config);
|
YGConfigFree(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, box_sizing_content_box_flex_basis_row) {
|
||||||
|
GTEST_SKIP();
|
||||||
|
|
||||||
|
YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
|
YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||||
|
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||||
|
YGNodeStyleSetWidth(root, 100);
|
||||||
|
YGNodeStyleSetHeight(root, 100);
|
||||||
|
|
||||||
|
YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetFlexBasis(root_child0, 50);
|
||||||
|
YGNodeStyleSetPadding(root_child0, YGEdgeLeft, 5);
|
||||||
|
YGNodeStyleSetPadding(root_child0, YGEdgeTop, 5);
|
||||||
|
YGNodeStyleSetPadding(root_child0, YGEdgeRight, 5);
|
||||||
|
YGNodeStyleSetPadding(root_child0, YGEdgeBottom, 5);
|
||||||
|
YGNodeStyleSetBorder(root_child0, YGEdgeLeft, 10);
|
||||||
|
YGNodeStyleSetBorder(root_child0, YGEdgeTop, 10);
|
||||||
|
YGNodeStyleSetBorder(root_child0, YGEdgeRight, 10);
|
||||||
|
YGNodeStyleSetBorder(root_child0, YGEdgeBottom, 10);
|
||||||
|
YGNodeStyleSetHeight(root_child0, 25);
|
||||||
|
YGNodeStyleSetBoxSizing(root_child0, YGBoxSizingContentBox);
|
||||||
|
YGNodeInsertChild(root, root_child0, 0);
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(55, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(55, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
|
YGConfigFree(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, box_sizing_border_box_flex_basis_row) {
|
||||||
|
YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
|
YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||||
|
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||||
|
YGNodeStyleSetWidth(root, 100);
|
||||||
|
YGNodeStyleSetHeight(root, 100);
|
||||||
|
|
||||||
|
YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetFlexBasis(root_child0, 50);
|
||||||
|
YGNodeStyleSetPadding(root_child0, YGEdgeLeft, 5);
|
||||||
|
YGNodeStyleSetPadding(root_child0, YGEdgeTop, 5);
|
||||||
|
YGNodeStyleSetPadding(root_child0, YGEdgeRight, 5);
|
||||||
|
YGNodeStyleSetPadding(root_child0, YGEdgeBottom, 5);
|
||||||
|
YGNodeStyleSetBorder(root_child0, YGEdgeLeft, 10);
|
||||||
|
YGNodeStyleSetBorder(root_child0, YGEdgeTop, 10);
|
||||||
|
YGNodeStyleSetBorder(root_child0, YGEdgeRight, 10);
|
||||||
|
YGNodeStyleSetBorder(root_child0, YGEdgeBottom, 10);
|
||||||
|
YGNodeStyleSetHeight(root_child0, 25);
|
||||||
|
YGNodeInsertChild(root, root_child0, 0);
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
|
YGConfigFree(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, box_sizing_content_box_flex_basis_column) {
|
||||||
|
GTEST_SKIP();
|
||||||
|
|
||||||
|
YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
|
YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||||
|
YGNodeStyleSetWidth(root, 100);
|
||||||
|
YGNodeStyleSetHeight(root, 100);
|
||||||
|
|
||||||
|
YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetFlexBasis(root_child0, 50);
|
||||||
|
YGNodeStyleSetPadding(root_child0, YGEdgeLeft, 5);
|
||||||
|
YGNodeStyleSetPadding(root_child0, YGEdgeTop, 5);
|
||||||
|
YGNodeStyleSetPadding(root_child0, YGEdgeRight, 5);
|
||||||
|
YGNodeStyleSetPadding(root_child0, YGEdgeBottom, 5);
|
||||||
|
YGNodeStyleSetBorder(root_child0, YGEdgeLeft, 10);
|
||||||
|
YGNodeStyleSetBorder(root_child0, YGEdgeTop, 10);
|
||||||
|
YGNodeStyleSetBorder(root_child0, YGEdgeRight, 10);
|
||||||
|
YGNodeStyleSetBorder(root_child0, YGEdgeBottom, 10);
|
||||||
|
YGNodeStyleSetHeight(root_child0, 25);
|
||||||
|
YGNodeStyleSetBoxSizing(root_child0, YGBoxSizingContentBox);
|
||||||
|
YGNodeInsertChild(root, root_child0, 0);
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
|
YGConfigFree(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, box_sizing_border_box_flex_basis_column) {
|
||||||
|
YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
|
YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||||
|
YGNodeStyleSetWidth(root, 100);
|
||||||
|
YGNodeStyleSetHeight(root, 100);
|
||||||
|
|
||||||
|
YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetFlexBasis(root_child0, 50);
|
||||||
|
YGNodeStyleSetPadding(root_child0, YGEdgeLeft, 5);
|
||||||
|
YGNodeStyleSetPadding(root_child0, YGEdgeTop, 5);
|
||||||
|
YGNodeStyleSetPadding(root_child0, YGEdgeRight, 5);
|
||||||
|
YGNodeStyleSetPadding(root_child0, YGEdgeBottom, 5);
|
||||||
|
YGNodeStyleSetBorder(root_child0, YGEdgeLeft, 10);
|
||||||
|
YGNodeStyleSetBorder(root_child0, YGEdgeTop, 10);
|
||||||
|
YGNodeStyleSetBorder(root_child0, YGEdgeRight, 10);
|
||||||
|
YGNodeStyleSetBorder(root_child0, YGEdgeBottom, 10);
|
||||||
|
YGNodeStyleSetHeight(root_child0, 25);
|
||||||
|
YGNodeInsertChild(root, root_child0, 0);
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
|
YGConfigFree(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, box_sizing_content_box_padding_start) {
|
||||||
|
YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
|
YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||||
|
YGNodeStyleSetPadding(root, YGEdgeStart, 5);
|
||||||
|
YGNodeStyleSetWidth(root, 100);
|
||||||
|
YGNodeStyleSetHeight(root, 100);
|
||||||
|
YGNodeStyleSetBoxSizing(root, YGBoxSizingContentBox);
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(105, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(105, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
|
YGConfigFree(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, box_sizing_border_box_padding_start) {
|
||||||
|
YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
|
YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||||
|
YGNodeStyleSetPadding(root, YGEdgeStart, 5);
|
||||||
|
YGNodeStyleSetWidth(root, 100);
|
||||||
|
YGNodeStyleSetHeight(root, 100);
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
|
YGConfigFree(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, box_sizing_content_box_padding_end) {
|
||||||
|
YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
|
YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||||
|
YGNodeStyleSetPadding(root, YGEdgeEnd, 5);
|
||||||
|
YGNodeStyleSetWidth(root, 100);
|
||||||
|
YGNodeStyleSetHeight(root, 100);
|
||||||
|
YGNodeStyleSetBoxSizing(root, YGBoxSizingContentBox);
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(105, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(105, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
|
YGConfigFree(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, box_sizing_border_box_padding_end) {
|
||||||
|
YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
|
YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||||
|
YGNodeStyleSetPadding(root, YGEdgeEnd, 5);
|
||||||
|
YGNodeStyleSetWidth(root, 100);
|
||||||
|
YGNodeStyleSetHeight(root, 100);
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
|
YGConfigFree(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, box_sizing_content_box_border_start) {
|
||||||
|
YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
|
YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||||
|
YGNodeStyleSetBorder(root, YGEdgeStart, 5);
|
||||||
|
YGNodeStyleSetWidth(root, 100);
|
||||||
|
YGNodeStyleSetHeight(root, 100);
|
||||||
|
YGNodeStyleSetBoxSizing(root, YGBoxSizingContentBox);
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(105, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(105, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
|
YGConfigFree(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, box_sizing_border_box_border_start) {
|
||||||
|
YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
|
YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||||
|
YGNodeStyleSetBorder(root, YGEdgeStart, 5);
|
||||||
|
YGNodeStyleSetWidth(root, 100);
|
||||||
|
YGNodeStyleSetHeight(root, 100);
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
|
YGConfigFree(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, box_sizing_content_box_border_end) {
|
||||||
|
YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
|
YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||||
|
YGNodeStyleSetBorder(root, YGEdgeEnd, 5);
|
||||||
|
YGNodeStyleSetWidth(root, 100);
|
||||||
|
YGNodeStyleSetHeight(root, 100);
|
||||||
|
YGNodeStyleSetBoxSizing(root, YGBoxSizingContentBox);
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(105, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(105, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
|
YGConfigFree(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, box_sizing_border_box_border_end) {
|
||||||
|
YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
|
YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||||
|
YGNodeStyleSetBorder(root, YGEdgeEnd, 5);
|
||||||
|
YGNodeStyleSetWidth(root, 100);
|
||||||
|
YGNodeStyleSetHeight(root, 100);
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
|
YGConfigFree(config);
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user