Do not mark node as dirty if, new and old values are undefined

Summary:
If we have a values already set to undefined and set it to undefined again, we invalidate the layout. This change takes this case into account and keeps the layout valid.
Fixes #630
Closes https://github.com/facebook/yoga/pull/648

Differential Revision: D6408013

Pulled By: emilsjolander

fbshipit-source-id: dc2a848d84d3de9f4650fac9e41d7c8169446406
This commit is contained in:
Lukas Wöhrl
2017-11-27 03:06:15 -08:00
committed by Facebook Github Bot
parent 55c767ba7f
commit 5aa0f44a9b
2 changed files with 128 additions and 80 deletions

View File

@@ -142,3 +142,20 @@ TEST(YogaTest, dirty_node_only_if_children_are_actually_removed) {
YGNodeFreeRecursive(root);
}
TEST(YogaTest, dirty_node_only_if_undefined_values_gets_set_to_undefined) {
const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidth(root, 50);
YGNodeStyleSetHeight(root, 50);
YGNodeStyleSetMinWidth(root, YGUndefined);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
EXPECT_FALSE(YGNodeIsDirty(root));
YGNodeStyleSetMinWidth(root, YGUndefined);
EXPECT_FALSE(YGNodeIsDirty(root));
YGNodeFreeRecursive(root);
}