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,11 +13,13 @@
|
||||
#include <yoga/Yoga.h>
|
||||
|
||||
TEST(YogaTest, max_width) {
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
YGNodeStyleSetHeight(root, 100);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetMaxWidth(root_child0, 50);
|
||||
YGNodeStyleSetHeight(root_child0, 10);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
@@ -46,15 +48,19 @@ TEST(YogaTest, max_width) {
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, max_height) {
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
YGNodeStyleSetHeight(root, 100);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root_child0, 10);
|
||||
YGNodeStyleSetMaxHeight(root_child0, 50);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
@@ -83,19 +89,23 @@ TEST(YogaTest, max_height) {
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, min_height) {
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
YGNodeStyleSetHeight(root, 100);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexGrow(root_child0, 1);
|
||||
YGNodeStyleSetMinHeight(root_child0, 60);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child1 = YGNodeNew();
|
||||
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexGrow(root_child1, 1);
|
||||
YGNodeInsertChild(root, root_child1, 1);
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
@@ -133,20 +143,24 @@ TEST(YogaTest, min_height) {
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, min_width) {
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
YGNodeStyleSetHeight(root, 100);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexGrow(root_child0, 1);
|
||||
YGNodeStyleSetMinWidth(root_child0, 60);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child1 = YGNodeNew();
|
||||
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexGrow(root_child1, 1);
|
||||
YGNodeInsertChild(root, root_child1, 1);
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
@@ -184,16 +198,20 @@ TEST(YogaTest, min_width) {
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, justify_content_min_max) {
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
YGNodeStyleSetMinHeight(root, 100);
|
||||
YGNodeStyleSetMaxHeight(root, 200);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root_child0, 60);
|
||||
YGNodeStyleSetHeight(root_child0, 60);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
@@ -222,16 +240,20 @@ TEST(YogaTest, justify_content_min_max) {
|
||||
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, align_items_min_max) {
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetAlignItems(root, YGAlignCenter);
|
||||
YGNodeStyleSetMinWidth(root, 100);
|
||||
YGNodeStyleSetMaxWidth(root, 200);
|
||||
YGNodeStyleSetHeight(root, 100);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root_child0, 60);
|
||||
YGNodeStyleSetHeight(root_child0, 60);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
@@ -260,25 +282,29 @@ TEST(YogaTest, align_items_min_max) {
|
||||
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, justify_content_overflow_min_max) {
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
|
||||
YGNodeStyleSetMinHeight(root, 100);
|
||||
YGNodeStyleSetMaxHeight(root, 110);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root_child0, 50);
|
||||
YGNodeStyleSetHeight(root_child0, 50);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child1 = YGNodeNew();
|
||||
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root_child1, 50);
|
||||
YGNodeStyleSetHeight(root_child1, 50);
|
||||
YGNodeInsertChild(root, root_child1, 1);
|
||||
|
||||
const YGNodeRef root_child2 = YGNodeNew();
|
||||
const YGNodeRef root_child2 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root_child2, 50);
|
||||
YGNodeStyleSetHeight(root_child2, 50);
|
||||
YGNodeInsertChild(root, root_child2, 2);
|
||||
@@ -327,22 +353,25 @@ TEST(YogaTest, justify_content_overflow_min_max) {
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child2));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, flex_grow_to_min) {
|
||||
YGSetExperimentalFeatureEnabled(YGExperimentalFeatureMinFlexFix, true);
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureMinFlexFix, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
YGNodeStyleSetMinHeight(root, 100);
|
||||
YGNodeStyleSetMaxHeight(root, 500);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexGrow(root_child0, 1);
|
||||
YGNodeStyleSetFlexShrink(root_child0, 1);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child1 = YGNodeNew();
|
||||
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetHeight(root_child1, 50);
|
||||
YGNodeInsertChild(root, root_child1, 1);
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
@@ -381,23 +410,24 @@ TEST(YogaTest, flex_grow_to_min) {
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGSetExperimentalFeatureEnabled(YGExperimentalFeatureMinFlexFix, false);
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, flex_grow_in_at_most_container) {
|
||||
YGSetExperimentalFeatureEnabled(YGExperimentalFeatureMinFlexFix, true);
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureMinFlexFix, true);
|
||||
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
YGNodeStyleSetAlignItems(root, YGAlignFlexStart);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
YGNodeStyleSetHeight(root, 100);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child0_child0 = YGNodeNew();
|
||||
const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexGrow(root_child0_child0, 1);
|
||||
YGNodeStyleSetFlexBasis(root_child0_child0, 0);
|
||||
YGNodeInsertChild(root_child0, root_child0_child0, 0);
|
||||
@@ -437,20 +467,22 @@ TEST(YogaTest, flex_grow_in_at_most_container) {
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGSetExperimentalFeatureEnabled(YGExperimentalFeatureMinFlexFix, false);
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, flex_grow_within_max_width) {
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 200);
|
||||
YGNodeStyleSetHeight(root, 100);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow);
|
||||
YGNodeStyleSetMaxWidth(root_child0, 100);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child0_child0 = YGNodeNew();
|
||||
const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexGrow(root_child0_child0, 1);
|
||||
YGNodeStyleSetHeight(root_child0_child0, 20);
|
||||
YGNodeInsertChild(root_child0, root_child0_child0, 0);
|
||||
@@ -489,19 +521,23 @@ TEST(YogaTest, flex_grow_within_max_width) {
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child0));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, flex_grow_within_constrained_max_width) {
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 200);
|
||||
YGNodeStyleSetHeight(root, 100);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow);
|
||||
YGNodeStyleSetMaxWidth(root_child0, 300);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child0_child0 = YGNodeNew();
|
||||
const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexGrow(root_child0_child0, 1);
|
||||
YGNodeStyleSetHeight(root_child0_child0, 20);
|
||||
YGNodeInsertChild(root_child0, root_child0_child0, 0);
|
||||
@@ -540,19 +576,23 @@ TEST(YogaTest, flex_grow_within_constrained_max_width) {
|
||||
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child0));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, flex_grow_within_constrained_min_row) {
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||
YGNodeStyleSetMinWidth(root, 100);
|
||||
YGNodeStyleSetHeight(root, 100);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexGrow(root_child0, 1);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child1 = YGNodeNew();
|
||||
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root_child1, 50);
|
||||
YGNodeInsertChild(root, root_child1, 1);
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
@@ -590,17 +630,21 @@ TEST(YogaTest, flex_grow_within_constrained_min_row) {
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, flex_grow_within_constrained_min_column) {
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetMinHeight(root, 100);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexGrow(root_child0, 1);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child1 = YGNodeNew();
|
||||
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetHeight(root_child1, 50);
|
||||
YGNodeInsertChild(root, root_child1, 1);
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
@@ -638,24 +682,28 @@ TEST(YogaTest, flex_grow_within_constrained_min_column) {
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child1));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, flex_grow_within_constrained_max_row) {
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 200);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow);
|
||||
YGNodeStyleSetMaxWidth(root_child0, 100);
|
||||
YGNodeStyleSetHeight(root_child0, 100);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child0_child0 = YGNodeNew();
|
||||
const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexShrink(root_child0_child0, 1);
|
||||
YGNodeStyleSetFlexBasis(root_child0_child0, 100);
|
||||
YGNodeInsertChild(root_child0, root_child0_child0, 0);
|
||||
|
||||
const YGNodeRef root_child0_child1 = YGNodeNew();
|
||||
const YGNodeRef root_child0_child1 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root_child0_child1, 50);
|
||||
YGNodeInsertChild(root_child0, root_child0_child1, 1);
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
@@ -703,19 +751,23 @@ TEST(YogaTest, flex_grow_within_constrained_max_row) {
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child0_child1));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, flex_grow_within_constrained_max_column) {
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
YGNodeStyleSetMaxHeight(root, 100);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetFlexShrink(root_child0, 1);
|
||||
YGNodeStyleSetFlexBasis(root_child0, 100);
|
||||
YGNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
const YGNodeRef root_child1 = YGNodeNew();
|
||||
const YGNodeRef root_child1 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetHeight(root_child1, 50);
|
||||
YGNodeInsertChild(root, root_child1, 1);
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
@@ -753,10 +805,14 @@ TEST(YogaTest, flex_grow_within_constrained_max_column) {
|
||||
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child1));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, min_width_overrides_width) {
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 50);
|
||||
YGNodeStyleSetMinWidth(root, 100);
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
@@ -774,10 +830,14 @@ TEST(YogaTest, min_width_overrides_width) {
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, max_width_overrides_width) {
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetWidth(root, 200);
|
||||
YGNodeStyleSetMaxWidth(root, 100);
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
@@ -795,10 +855,14 @@ TEST(YogaTest, max_width_overrides_width) {
|
||||
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, min_height_overrides_height) {
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetHeight(root, 50);
|
||||
YGNodeStyleSetMinHeight(root, 100);
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
@@ -816,10 +880,14 @@ TEST(YogaTest, min_height_overrides_height) {
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, max_height_overrides_height) {
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetHeight(root, 200);
|
||||
YGNodeStyleSetMaxHeight(root, 100);
|
||||
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||
@@ -837,15 +905,19 @@ TEST(YogaTest, max_height_overrides_height) {
|
||||
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
||||
TEST(YogaTest, min_max_percent_no_width_height) {
|
||||
const YGNodeRef root = YGNodeNew();
|
||||
const YGConfigRef config = YGConfigNew();
|
||||
|
||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetAlignItems(root, YGAlignFlexStart);
|
||||
YGNodeStyleSetWidth(root, 100);
|
||||
YGNodeStyleSetHeight(root, 100);
|
||||
|
||||
const YGNodeRef root_child0 = YGNodeNew();
|
||||
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||
YGNodeStyleSetMinWidthPercent(root_child0, 10);
|
||||
YGNodeStyleSetMaxWidthPercent(root_child0, 10);
|
||||
YGNodeStyleSetMinHeightPercent(root_child0, 10);
|
||||
@@ -876,4 +948,6 @@ TEST(YogaTest, min_max_percent_no_width_height) {
|
||||
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
|
||||
|
||||
YGNodeFreeRecursive(root);
|
||||
|
||||
YGConfigFree(config);
|
||||
}
|
||||
|
Reference in New Issue
Block a user