diff --git a/gentest/fixtures/YGAbsolutePositionTest.html b/gentest/fixtures/YGAbsolutePositionTest.html
index fb05160794..673d257b8a 100644
--- a/gentest/fixtures/YGAbsolutePositionTest.html
+++ b/gentest/fixtures/YGAbsolutePositionTest.html
@@ -132,6 +132,22 @@
>
+ * @generated SignedSource<<3ccb0b2604c647cde1c76fc2629a3113>>
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAbsolutePositionTest.html
*/
@@ -1357,6 +1357,162 @@ public void test_absolute_layout_padding_bottom() {
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
}
+ @Test
+ public void test_absolute_layout_padding() {
+ YogaConfig config = YogaConfigFactory.create();
+
+ final YogaNode root = createNode(config);
+ root.setPositionType(YogaPositionType.ABSOLUTE);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setMargin(YogaEdge.LEFT, 10f);
+ root_child0.setMargin(YogaEdge.TOP, 10f);
+ root_child0.setMargin(YogaEdge.RIGHT, 10f);
+ root_child0.setMargin(YogaEdge.BOTTOM, 10f);
+ root_child0.setWidth(200f);
+ root_child0.setHeight(200f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0.setPadding(YogaEdge.LEFT, 50);
+ root_child0_child0.setPadding(YogaEdge.TOP, 50);
+ root_child0_child0.setPadding(YogaEdge.RIGHT, 50);
+ root_child0_child0.setPadding(YogaEdge.BOTTOM, 50);
+ root_child0_child0.setWidth(200f);
+ root_child0_child0.setHeight(200f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0 = createNode(config);
+ root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
+ root_child0_child0_child0.setWidth(50f);
+ root_child0_child0_child0.setHeight(50f);
+ root_child0_child0.addChildAt(root_child0_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(220f, root.getLayoutWidth(), 0.0f);
+ assertEquals(220f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(10f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(10f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(200f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(50f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_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(220f, root.getLayoutWidth(), 0.0f);
+ assertEquals(220f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(10f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(10f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(200f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(100f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+ }
+
+ @Test
+ public void test_absolute_layout_border() {
+ YogaConfig config = YogaConfigFactory.create();
+
+ final YogaNode root = createNode(config);
+ root.setPositionType(YogaPositionType.ABSOLUTE);
+
+ final YogaNode root_child0 = createNode(config);
+ root_child0.setMargin(YogaEdge.LEFT, 10f);
+ root_child0.setMargin(YogaEdge.TOP, 10f);
+ root_child0.setMargin(YogaEdge.RIGHT, 10f);
+ root_child0.setMargin(YogaEdge.BOTTOM, 10f);
+ root_child0.setWidth(200f);
+ root_child0.setHeight(200f);
+ root.addChildAt(root_child0, 0);
+
+ final YogaNode root_child0_child0 = createNode(config);
+ root_child0_child0.setPositionType(YogaPositionType.STATIC);
+ root_child0_child0.setBorder(YogaEdge.LEFT, 10f);
+ root_child0_child0.setBorder(YogaEdge.TOP, 10f);
+ root_child0_child0.setBorder(YogaEdge.RIGHT, 10f);
+ root_child0_child0.setBorder(YogaEdge.BOTTOM, 10f);
+ root_child0_child0.setWidth(200f);
+ root_child0_child0.setHeight(200f);
+ root_child0.addChildAt(root_child0_child0, 0);
+
+ final YogaNode root_child0_child0_child0 = createNode(config);
+ root_child0_child0_child0.setPositionType(YogaPositionType.ABSOLUTE);
+ root_child0_child0_child0.setWidth(50f);
+ root_child0_child0_child0.setHeight(50f);
+ root_child0_child0.addChildAt(root_child0_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(220f, root.getLayoutWidth(), 0.0f);
+ assertEquals(220f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(10f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(10f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(200f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(10f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(10f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_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(220f, root.getLayoutWidth(), 0.0f);
+ assertEquals(220f, root.getLayoutHeight(), 0.0f);
+
+ assertEquals(10f, root_child0.getLayoutX(), 0.0f);
+ assertEquals(10f, root_child0.getLayoutY(), 0.0f);
+ assertEquals(200f, root_child0.getLayoutWidth(), 0.0f);
+ assertEquals(200f, root_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(200f, root_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(200f, root_child0_child0.getLayoutHeight(), 0.0f);
+
+ assertEquals(140f, root_child0_child0_child0.getLayoutX(), 0.0f);
+ assertEquals(10f, root_child0_child0_child0.getLayoutY(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
+ assertEquals(50f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
+ }
+
@Test
public void test_absolute_layout_column_reverse_margin_border() {
YogaConfig config = YogaConfigFactory.create();
diff --git a/javascript/tests/generated/YGAbsolutePositionTest.test.ts b/javascript/tests/generated/YGAbsolutePositionTest.test.ts
index 5b686632ac..1af20d765c 100644
--- a/javascript/tests/generated/YGAbsolutePositionTest.test.ts
+++ b/javascript/tests/generated/YGAbsolutePositionTest.test.ts
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
- * @generated SignedSource<<777a238fc942436d2c803822110bcd07>>
+ * @generated SignedSource<<9c27293180ef7ffd5b683046588f9dd7>>
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAbsolutePositionTest.html
*/
@@ -1497,6 +1497,172 @@ test('absolute_layout_padding_bottom', () => {
config.free();
}
});
+test('absolute_layout_padding', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ try {
+ root = Yoga.Node.create(config);
+ root.setPositionType(PositionType.Absolute);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setMargin(Edge.Left, 10);
+ root_child0.setMargin(Edge.Top, 10);
+ root_child0.setMargin(Edge.Right, 10);
+ root_child0.setMargin(Edge.Bottom, 10);
+ root_child0.setWidth(200);
+ root_child0.setHeight(200);
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0.setPadding(Edge.Left, 50);
+ root_child0_child0.setPadding(Edge.Top, 50);
+ root_child0_child0.setPadding(Edge.Right, 50);
+ root_child0_child0.setPadding(Edge.Bottom, 50);
+ root_child0_child0.setWidth(200);
+ root_child0_child0.setHeight(200);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0.setPositionType(PositionType.Absolute);
+ root_child0_child0_child0.setWidth(50);
+ root_child0_child0_child0.setHeight(50);
+ root_child0_child0.insertChild(root_child0_child0_child0, 0);
+ root.calculateLayout(undefined, undefined, Direction.LTR);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(0);
+ expect(root.getComputedWidth()).toBe(220);
+ expect(root.getComputedHeight()).toBe(220);
+
+ expect(root_child0.getComputedLeft()).toBe(10);
+ expect(root_child0.getComputedTop()).toBe(10);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(200);
+ expect(root_child0_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(50);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(50);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+
+ root.calculateLayout(undefined, undefined, Direction.RTL);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(0);
+ expect(root.getComputedWidth()).toBe(220);
+ expect(root.getComputedHeight()).toBe(220);
+
+ expect(root_child0.getComputedLeft()).toBe(10);
+ expect(root_child0.getComputedTop()).toBe(10);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(200);
+ expect(root_child0_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(100);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(50);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
+test('absolute_layout_border', () => {
+ const config = Yoga.Config.create();
+ let root;
+
+ try {
+ root = Yoga.Node.create(config);
+ root.setPositionType(PositionType.Absolute);
+
+ const root_child0 = Yoga.Node.create(config);
+ root_child0.setMargin(Edge.Left, 10);
+ root_child0.setMargin(Edge.Top, 10);
+ root_child0.setMargin(Edge.Right, 10);
+ root_child0.setMargin(Edge.Bottom, 10);
+ root_child0.setWidth(200);
+ root_child0.setHeight(200);
+ root.insertChild(root_child0, 0);
+
+ const root_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0.setPositionType(PositionType.Static);
+ root_child0_child0.setBorder(Edge.Left, 10);
+ root_child0_child0.setBorder(Edge.Top, 10);
+ root_child0_child0.setBorder(Edge.Right, 10);
+ root_child0_child0.setBorder(Edge.Bottom, 10);
+ root_child0_child0.setWidth(200);
+ root_child0_child0.setHeight(200);
+ root_child0.insertChild(root_child0_child0, 0);
+
+ const root_child0_child0_child0 = Yoga.Node.create(config);
+ root_child0_child0_child0.setPositionType(PositionType.Absolute);
+ root_child0_child0_child0.setWidth(50);
+ root_child0_child0_child0.setHeight(50);
+ root_child0_child0.insertChild(root_child0_child0_child0, 0);
+ root.calculateLayout(undefined, undefined, Direction.LTR);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(0);
+ expect(root.getComputedWidth()).toBe(220);
+ expect(root.getComputedHeight()).toBe(220);
+
+ expect(root_child0.getComputedLeft()).toBe(10);
+ expect(root_child0.getComputedTop()).toBe(10);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(200);
+ expect(root_child0_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(10);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(10);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+
+ root.calculateLayout(undefined, undefined, Direction.RTL);
+
+ expect(root.getComputedLeft()).toBe(0);
+ expect(root.getComputedTop()).toBe(0);
+ expect(root.getComputedWidth()).toBe(220);
+ expect(root.getComputedHeight()).toBe(220);
+
+ expect(root_child0.getComputedLeft()).toBe(10);
+ expect(root_child0.getComputedTop()).toBe(10);
+ expect(root_child0.getComputedWidth()).toBe(200);
+ expect(root_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0.getComputedLeft()).toBe(0);
+ expect(root_child0_child0.getComputedTop()).toBe(0);
+ expect(root_child0_child0.getComputedWidth()).toBe(200);
+ expect(root_child0_child0.getComputedHeight()).toBe(200);
+
+ expect(root_child0_child0_child0.getComputedLeft()).toBe(140);
+ expect(root_child0_child0_child0.getComputedTop()).toBe(10);
+ expect(root_child0_child0_child0.getComputedWidth()).toBe(50);
+ expect(root_child0_child0_child0.getComputedHeight()).toBe(50);
+ } finally {
+ if (typeof root !== 'undefined') {
+ root.freeRecursive();
+ }
+
+ config.free();
+ }
+});
test('absolute_layout_column_reverse_margin_border', () => {
const config = Yoga.Config.create();
let root;
diff --git a/tests/generated/YGAbsolutePositionTest.cpp b/tests/generated/YGAbsolutePositionTest.cpp
index 740dc26660..cccea82205 100644
--- a/tests/generated/YGAbsolutePositionTest.cpp
+++ b/tests/generated/YGAbsolutePositionTest.cpp
@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* clang-format off
- * @generated SignedSource<<43fe6d73966bf8e4694c57420a0fb9d9>>
+ * @generated SignedSource<<82fd46be79c6a75de5216cce4ad10095>>
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAbsolutePositionTest.html
*/
@@ -1371,6 +1371,164 @@ TEST(YogaTest, absolute_layout_padding_bottom) {
YGConfigFree(config);
}
+TEST(YogaTest, absolute_layout_padding) {
+ const YGConfigRef config = YGConfigNew();
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetMargin(root_child0, YGEdgeLeft, 10);
+ YGNodeStyleSetMargin(root_child0, YGEdgeTop, 10);
+ YGNodeStyleSetMargin(root_child0, YGEdgeRight, 10);
+ YGNodeStyleSetMargin(root_child0, YGEdgeBottom, 10);
+ YGNodeStyleSetWidth(root_child0, 200);
+ YGNodeStyleSetHeight(root_child0, 200);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetPadding(root_child0_child0, YGEdgeLeft, 50);
+ YGNodeStyleSetPadding(root_child0_child0, YGEdgeTop, 50);
+ YGNodeStyleSetPadding(root_child0_child0, YGEdgeRight, 50);
+ YGNodeStyleSetPadding(root_child0_child0, YGEdgeBottom, 50);
+ YGNodeStyleSetWidth(root_child0_child0, 200);
+ YGNodeStyleSetHeight(root_child0_child0, 200);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0_child0, YGPositionTypeAbsolute);
+ YGNodeStyleSetWidth(root_child0_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0_child0, 50);
+ YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(220, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(220, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(10, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(220, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(220, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(10, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(100, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
+TEST(YogaTest, absolute_layout_border) {
+ const YGConfigRef config = YGConfigNew();
+
+ const YGNodeRef root = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
+
+ const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetMargin(root_child0, YGEdgeLeft, 10);
+ YGNodeStyleSetMargin(root_child0, YGEdgeTop, 10);
+ YGNodeStyleSetMargin(root_child0, YGEdgeRight, 10);
+ YGNodeStyleSetMargin(root_child0, YGEdgeBottom, 10);
+ YGNodeStyleSetWidth(root_child0, 200);
+ YGNodeStyleSetHeight(root_child0, 200);
+ YGNodeInsertChild(root, root_child0, 0);
+
+ const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeStatic);
+ YGNodeStyleSetBorder(root_child0_child0, YGEdgeLeft, 10);
+ YGNodeStyleSetBorder(root_child0_child0, YGEdgeTop, 10);
+ YGNodeStyleSetBorder(root_child0_child0, YGEdgeRight, 10);
+ YGNodeStyleSetBorder(root_child0_child0, YGEdgeBottom, 10);
+ YGNodeStyleSetWidth(root_child0_child0, 200);
+ YGNodeStyleSetHeight(root_child0_child0, 200);
+ YGNodeInsertChild(root_child0, root_child0_child0, 0);
+
+ const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
+ YGNodeStyleSetPositionType(root_child0_child0_child0, YGPositionTypeAbsolute);
+ YGNodeStyleSetWidth(root_child0_child0_child0, 50);
+ YGNodeStyleSetHeight(root_child0_child0_child0, 50);
+ YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(220, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(220, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(10, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(10, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
+ ASSERT_FLOAT_EQ(220, YGNodeLayoutGetWidth(root));
+ ASSERT_FLOAT_EQ(220, YGNodeLayoutGetHeight(root));
+
+ ASSERT_FLOAT_EQ(10, YGNodeLayoutGetLeft(root_child0));
+ ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child0));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root_child0));
+
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
+ ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root_child0_child0));
+ ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root_child0_child0));
+
+ ASSERT_FLOAT_EQ(140, YGNodeLayoutGetLeft(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
+ ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
+
+ YGNodeFreeRecursive(root);
+
+ YGConfigFree(config);
+}
+
TEST(YogaTest, absolute_layout_column_reverse_margin_border) {
const YGConfigRef config = YGConfigNew();