Fixed a typo and added a test case
Summary: Fixed a typo of flexshrink and added a test case Reviewed By: emilsjolander Differential Revision: D7289221 fbshipit-source-id: 48ee9ccfac4adee51d515a366b5a11790f7236fc
This commit is contained in:
committed by
Facebook Github Bot
parent
0dde40ce0b
commit
ae86824636
@@ -57,3 +57,26 @@ TEST(YogaTest, copy_style_modified_same) {
|
|||||||
YGNodeFree(node0);
|
YGNodeFree(node0);
|
||||||
YGNodeFree(node1);
|
YGNodeFree(node1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, initialise_flexShrink_flexGrow) {
|
||||||
|
const YGNodeRef node0 = YGNodeNew();
|
||||||
|
YGNodeStyleSetFlexShrink(node0, 1);
|
||||||
|
ASSERT_EQ(1, YGNodeStyleGetFlexShrink(node0));
|
||||||
|
|
||||||
|
YGNodeStyleSetFlexShrink(node0, YGUndefined);
|
||||||
|
YGNodeStyleSetFlexGrow(node0, 3);
|
||||||
|
ASSERT_EQ(
|
||||||
|
0,
|
||||||
|
YGNodeStyleGetFlexShrink(
|
||||||
|
node0)); // Default value is Zero, if flex shrink is not defined
|
||||||
|
ASSERT_EQ(3, YGNodeStyleGetFlexGrow(node0));
|
||||||
|
|
||||||
|
YGNodeStyleSetFlexGrow(node0, YGUndefined);
|
||||||
|
YGNodeStyleSetFlexShrink(node0, 3);
|
||||||
|
ASSERT_EQ(
|
||||||
|
0,
|
||||||
|
YGNodeStyleGetFlexGrow(
|
||||||
|
node0)); // Default value is Zero, if flex grow is not defined
|
||||||
|
ASSERT_EQ(3, YGNodeStyleGetFlexShrink(node0));
|
||||||
|
YGNodeFree(node0);
|
||||||
|
}
|
||||||
|
@@ -778,7 +778,7 @@ void YGNodeStyleSetFlexShrink(const YGNodeRef node, const float flexShrink) {
|
|||||||
if (!YGFloatOptionalFloatEquals(node->getStyle().flexShrink, flexShrink)) {
|
if (!YGFloatOptionalFloatEquals(node->getStyle().flexShrink, flexShrink)) {
|
||||||
YGStyle style = node->getStyle();
|
YGStyle style = node->getStyle();
|
||||||
if (YGFloatIsUndefined(flexShrink)) {
|
if (YGFloatIsUndefined(flexShrink)) {
|
||||||
style.flexGrow = {true, 0};
|
style.flexShrink = {true, 0};
|
||||||
} else {
|
} else {
|
||||||
style.flexShrink = {false, flexShrink};
|
style.flexShrink = {false, flexShrink};
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user