Move configuration to new YGConfig and pass them down to CalculateLayout
Summary: Move configuration to new ```YGConfig``` and pass them down to CalculateLayout. See #418 . Adds ```YGConfigNew()``` + ```YGConfigFree```, and changed ```YGSetExperimentalFeatureEnabled``` to use the config. New function for calculation is ```YGNodeCalculateLayoutWithConfig```. Closes https://github.com/facebook/yoga/pull/432 Reviewed By: astreet Differential Revision: D4611359 Pulled By: emilsjolander fbshipit-source-id: a1332f0e1b21cec02129dd021ee57408449e10b0
This commit is contained in:
committed by
Facebook Github Bot
parent
8668e43f6d
commit
37c48257ae
@@ -13,9 +13,11 @@
|
||||
#include <yoga/Yoga.h>
|
||||
|
||||
TEST(YogaTest, wrap_child) {
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root_child0, 100);
|
||||
YGNodeStyleSetHeight(root_child0, 100);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
@@ -44,15 +46,19 @@ TEST(YogaTest, wrap_child) {
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, wrap_grandchild) {
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child0_child0 = YGNodeNew();
|
||||
const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root_child0_child0, 100);
|
||||
YGNodeStyleSetHeight(root_child0_child0, 100);
|
||||
YGNodeInsertChild(root_child0, root_child0_child0, 0);
|
||||
@@ -91,4 +97,6 @@ TEST(YogaTest, wrap_grandchild) {
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child0));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
Reference in New Issue
Block a user