Always return undefined value if nothing is set

Summary: This reflects a check to native code where style values will always return the value that was set on them and default to undefined.

Reviewed By: astreet

Differential Revision: D4531779

fbshipit-source-id: 97a789e70dcf0fb5174e2039991e7a2b27f45f01
This commit is contained in:
Emil Sjolander
2017-02-11 06:19:56 -08:00
committed by Facebook Github Bot
parent 6ceb4af2d4
commit 168ae4099d
2 changed files with 15 additions and 3 deletions

View File

@@ -230,4 +230,16 @@ public class YogaNodeTest {
assertEquals(5, (int) node.getLayoutPadding(YogaEdge.TOP));
assertEquals(5, (int) node.getLayoutPadding(YogaEdge.BOTTOM));
}
@Test
public void testDefaultEdgeValues() {
final YogaNode node = new YogaNode();
for (YogaEdge edge : YogaEdge.values()) {
assertEquals(YogaUnit.UNDEFINED, node.getMargin(edge).unit);
assertEquals(YogaUnit.UNDEFINED, node.getPadding(edge).unit);
assertEquals(YogaUnit.UNDEFINED, node.getPosition(edge).unit);
assertTrue(YogaConstants.isUndefined(node.getBorder(edge)));
}
}
}