Add another nested percentage test

Summary: Add test covering a nested percentage container inside of a unconstraint container. This is something we ran into recently and want to make sure to cover in tests.

Reviewed By: astreet

Differential Revision: D4637519

fbshipit-source-id: a8fe3c7702c2ea0ad954cce80fbdf953bb23c997
This commit is contained in:
Emil Sjolander
2017-03-03 10:15:51 -08:00
committed by Facebook Github Bot
parent 0fde1424f0
commit e7d2792009
5 changed files with 363 additions and 5 deletions

View File

@@ -1059,5 +1059,92 @@ namespace Facebook.Yoga
Assert.AreEqual(100f, root_child2.LayoutHeight);
}
[Test]
public void Test_percentage_container_in_wrapping_container()
{
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.MinFlexFix, true);
YogaNode root = new YogaNode(config);
root.JustifyContent = YogaJustify.Center;
root.AlignItems = YogaAlign.Center;
root.Width = 200;
root.Height = 200;
YogaNode root_child0 = new YogaNode(config);
root.Insert(0, root_child0);
YogaNode root_child0_child0 = new YogaNode(config);
root_child0_child0.FlexDirection = YogaFlexDirection.Row;
root_child0_child0.JustifyContent = YogaJustify.Center;
root_child0_child0.Width = 100.Percent();
root_child0.Insert(0, root_child0_child0);
YogaNode root_child0_child0_child0 = new YogaNode(config);
root_child0_child0_child0.Width = 50;
root_child0_child0_child0.Height = 50;
root_child0_child0.Insert(0, root_child0_child0_child0);
YogaNode root_child0_child0_child1 = new YogaNode(config);
root_child0_child0_child1.Width = 50;
root_child0_child0_child1.Height = 50;
root_child0_child0.Insert(1, root_child0_child0_child1);
root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(200f, root.LayoutWidth);
Assert.AreEqual(200f, root.LayoutHeight);
Assert.AreEqual(50f, root_child0.LayoutX);
Assert.AreEqual(75f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(50f, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0_child0.LayoutX);
Assert.AreEqual(0f, root_child0_child0.LayoutY);
Assert.AreEqual(100f, root_child0_child0.LayoutWidth);
Assert.AreEqual(50f, root_child0_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0_child0_child0.LayoutX);
Assert.AreEqual(0f, root_child0_child0_child0.LayoutY);
Assert.AreEqual(50f, root_child0_child0_child0.LayoutWidth);
Assert.AreEqual(50f, root_child0_child0_child0.LayoutHeight);
Assert.AreEqual(50f, root_child0_child0_child1.LayoutX);
Assert.AreEqual(0f, root_child0_child0_child1.LayoutY);
Assert.AreEqual(50f, root_child0_child0_child1.LayoutWidth);
Assert.AreEqual(50f, root_child0_child0_child1.LayoutHeight);
root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(200f, root.LayoutWidth);
Assert.AreEqual(200f, root.LayoutHeight);
Assert.AreEqual(50f, root_child0.LayoutX);
Assert.AreEqual(75f, root_child0.LayoutY);
Assert.AreEqual(100f, root_child0.LayoutWidth);
Assert.AreEqual(50f, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0_child0.LayoutX);
Assert.AreEqual(0f, root_child0_child0.LayoutY);
Assert.AreEqual(100f, root_child0_child0.LayoutWidth);
Assert.AreEqual(50f, root_child0_child0.LayoutHeight);
Assert.AreEqual(50f, root_child0_child0_child0.LayoutX);
Assert.AreEqual(0f, root_child0_child0_child0.LayoutY);
Assert.AreEqual(50f, root_child0_child0_child0.LayoutWidth);
Assert.AreEqual(50f, root_child0_child0_child0.LayoutHeight);
Assert.AreEqual(0f, root_child0_child0_child1.LayoutX);
Assert.AreEqual(0f, root_child0_child0_child1.LayoutY);
Assert.AreEqual(50f, root_child0_child0_child1.LayoutWidth);
Assert.AreEqual(50f, root_child0_child0_child1.LayoutHeight);
}
}
}

View File

@@ -85,9 +85,18 @@
</div>
<div id="percent_within_flex_grow" style="flex-direction:row; width: 350px; height: 100px; align-items: stretch; ">
<div style="width:100px;"></div>
<div style="flex-grow: 1;">
<div style="width:100%;"></div>
<div style="width:100px;"></div>
<div style="flex-grow: 1;">
<div style="width:100%;"></div>
</div>
<div style="width: 100px;"></div>
</div>
<div id="percentage_container_in_wrapping_container" experiments="MinFlexFix" style="align-items: center; width: 200px; height: 200px; justify-content: center;">
<div>
<div style="alignItems: center; flex-direction: row; justify-content: center; width: 100%;">
<div style="width: 50px; height: 50px;"></div>
<div style="width: 50px; height: 50px;"></div>
</div>
<div style="width: 100px;"></div>
</div>
</div>
</div>

View File

@@ -1040,4 +1040,90 @@ public class YGPercentageTest {
assertEquals(100f, root_child2.getLayoutHeight(), 0.0f);
}
@Test
public void test_percentage_container_in_wrapping_container() {
YogaConfig config = new YogaConfig();
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.MIN_FLEX_FIX, true);
final YogaNode root = new YogaNode(config);
root.setJustifyContent(YogaJustify.CENTER);
root.setAlignItems(YogaAlign.CENTER);
root.setWidth(200f);
root.setHeight(200f);
final YogaNode root_child0 = new YogaNode(config);
root.addChildAt(root_child0, 0);
final YogaNode root_child0_child0 = new YogaNode(config);
root_child0_child0.setFlexDirection(YogaFlexDirection.ROW);
root_child0_child0.setJustifyContent(YogaJustify.CENTER);
root_child0_child0.setWidthPercent(100f);
root_child0.addChildAt(root_child0_child0, 0);
final YogaNode root_child0_child0_child0 = new YogaNode(config);
root_child0_child0_child0.setWidth(50f);
root_child0_child0_child0.setHeight(50f);
root_child0_child0.addChildAt(root_child0_child0_child0, 0);
final YogaNode root_child0_child0_child1 = new YogaNode(config);
root_child0_child0_child1.setWidth(50f);
root_child0_child0_child1.setHeight(50f);
root_child0_child0.addChildAt(root_child0_child0_child1, 1);
root.setDirection(YogaDirection.LTR);
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(200f, root.getLayoutWidth(), 0.0f);
assertEquals(200f, root.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
assertEquals(75f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f);
assertEquals(0f, 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);
assertEquals(50f, root_child0_child0_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child0_child0_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child0_child0_child1.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child0_child0_child1.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(200f, root.getLayoutWidth(), 0.0f);
assertEquals(200f, root.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
assertEquals(75f, root_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child0_child0.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child0_child0_child0.getLayoutX(), 0.0f);
assertEquals(0f, 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);
assertEquals(0f, root_child0_child0_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child0_child0_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child0_child0_child1.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child0_child0_child1.getLayoutHeight(), 0.0f);
}
}

View File

@@ -1083,3 +1083,92 @@ it("percent_within_flex_grow", function () {
}
}
});
it("percentage_container_in_wrapping_container", function () {
Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_MIN_FLEX_FIX, true);
try {
var root = Yoga.Node.create(config);
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
root.setAlignItems(Yoga.ALIGN_CENTER);
root.setWidth(200);
root.setHeight(200);
var root_child0 = Yoga.Node.create(config);
root.insertChild(root_child0, 0);
var root_child0_child0 = Yoga.Node.create(config);
root_child0_child0.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
root_child0_child0.setJustifyContent(Yoga.JUSTIFY_CENTER);
root_child0_child0.setWidth("100%");
root_child0.insertChild(root_child0_child0, 0);
var root_child0_child0_child0 = Yoga.Node.create(config);
root_child0_child0_child0.setWidth(50);
root_child0_child0_child0.setHeight(50);
root_child0_child0.insertChild(root_child0_child0_child0, 0);
var root_child0_child0_child1 = Yoga.Node.create(config);
root_child0_child0_child1.setWidth(50);
root_child0_child0_child1.setHeight(50);
root_child0_child0.insertChild(root_child0_child0_child1, 1);
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
console.assert(75 === root_child0.getComputedTop(), "75 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")");
console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")");
console.assert(100 === root_child0_child0.getComputedWidth(), "100 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")");
console.assert(50 === root_child0_child0.getComputedHeight(), "50 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")");
console.assert(0 === root_child0_child0_child0.getComputedLeft(), "0 === root_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0.getComputedLeft() + ")");
console.assert(0 === root_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0.getComputedTop() + ")");
console.assert(50 === root_child0_child0_child0.getComputedWidth(), "50 === root_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0.getComputedWidth() + ")");
console.assert(50 === root_child0_child0_child0.getComputedHeight(), "50 === root_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0.getComputedHeight() + ")");
console.assert(50 === root_child0_child0_child1.getComputedLeft(), "50 === root_child0_child0_child1.getComputedLeft() (" + root_child0_child0_child1.getComputedLeft() + ")");
console.assert(0 === root_child0_child0_child1.getComputedTop(), "0 === root_child0_child0_child1.getComputedTop() (" + root_child0_child0_child1.getComputedTop() + ")");
console.assert(50 === root_child0_child0_child1.getComputedWidth(), "50 === root_child0_child0_child1.getComputedWidth() (" + root_child0_child0_child1.getComputedWidth() + ")");
console.assert(50 === root_child0_child0_child1.getComputedHeight(), "50 === root_child0_child0_child1.getComputedHeight() (" + root_child0_child0_child1.getComputedHeight() + ")");
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
console.assert(0 === root.getComputedTop(), "0 === root.getComputedTop() (" + root.getComputedTop() + ")");
console.assert(200 === root.getComputedWidth(), "200 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
console.assert(200 === root.getComputedHeight(), "200 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
console.assert(50 === root_child0.getComputedLeft(), "50 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
console.assert(75 === root_child0.getComputedTop(), "75 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
console.assert(50 === root_child0.getComputedHeight(), "50 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")");
console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")");
console.assert(100 === root_child0_child0.getComputedWidth(), "100 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")");
console.assert(50 === root_child0_child0.getComputedHeight(), "50 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")");
console.assert(50 === root_child0_child0_child0.getComputedLeft(), "50 === root_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0.getComputedLeft() + ")");
console.assert(0 === root_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0.getComputedTop() + ")");
console.assert(50 === root_child0_child0_child0.getComputedWidth(), "50 === root_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0.getComputedWidth() + ")");
console.assert(50 === root_child0_child0_child0.getComputedHeight(), "50 === root_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0.getComputedHeight() + ")");
console.assert(0 === root_child0_child0_child1.getComputedLeft(), "0 === root_child0_child0_child1.getComputedLeft() (" + root_child0_child0_child1.getComputedLeft() + ")");
console.assert(0 === root_child0_child0_child1.getComputedTop(), "0 === root_child0_child0_child1.getComputedTop() (" + root_child0_child0_child1.getComputedTop() + ")");
console.assert(50 === root_child0_child0_child1.getComputedWidth(), "50 === root_child0_child0_child1.getComputedWidth() (" + root_child0_child0_child1.getComputedWidth() + ")");
console.assert(50 === root_child0_child0_child1.getComputedHeight(), "50 === root_child0_child0_child1.getComputedHeight() (" + root_child0_child0_child1.getComputedHeight() + ")");
} finally {
if (typeof root !== "undefined") {
root.freeRecursive();
}
Yoga.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_MIN_FLEX_FIX, false);
}
});

View File

@@ -1053,3 +1053,90 @@ TEST(YogaTest, percent_within_flex_grow) {
YGConfigFree(config);
}
TEST(YogaTest, percentage_container_in_wrapping_container) {
const YGConfigRef config = YGConfigNew();
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureMinFlexFix, true);
const YGNodeRef root = YGNodeNewWithConfig(config);
YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
YGNodeStyleSetAlignItems(root, YGAlignCenter);
YGNodeStyleSetWidth(root, 200);
YGNodeStyleSetHeight(root, 200);
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
YGNodeStyleSetFlexDirection(root_child0_child0, YGFlexDirectionRow);
YGNodeStyleSetJustifyContent(root_child0_child0, YGJustifyCenter);
YGNodeStyleSetWidthPercent(root_child0_child0, 100);
YGNodeInsertChild(root_child0, root_child0_child0, 0);
const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
YGNodeStyleSetWidth(root_child0_child0_child0, 50);
YGNodeStyleSetHeight(root_child0_child0_child0, 50);
YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
const YGNodeRef root_child0_child0_child1 = YGNodeNewWithConfig(config);
YGNodeStyleSetWidth(root_child0_child0_child1, 50);
YGNodeStyleSetHeight(root_child0_child0_child1, 50);
YGNodeInsertChild(root_child0_child0, root_child0_child0_child1, 1);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(75, YGNodeLayoutGetTop(root_child0));
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0_child0_child1));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child1));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child1));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child1));
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
ASSERT_FLOAT_EQ(200, YGNodeLayoutGetWidth(root));
ASSERT_FLOAT_EQ(200, YGNodeLayoutGetHeight(root));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(75, YGNodeLayoutGetTop(root_child0));
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0_child0_child0));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child0));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child0));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child1));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child1));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0_child0_child1));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0_child0_child1));
YGNodeFreeRecursive(root);
YGConfigFree(config);
}