public bool Set(int spacingType, float value) { if (FloatEqual(_spacing[spacingType], value)) { _spacing[spacingType] = value; if (CSSConstants.IsUndefined(value)) { _valueFlags &= ~_flagsMap[spacingType]; } else { _valueFlags |= ~_flagsMap[spacingType]; } _hasAliasesSet = (_valueFlags & _flagsMap[All]) != 0 || (_valueFlags & _flagsMap[Vertical]) != 0 || (_valueFlags & _flagsMap[Horizontal]) != 0; return(true); } return(false); }
public void TestCopyStyle() { CSSNode node0 = new CSSNode(); Assert.IsTrue(CSSConstants.IsUndefined(node0.StyleMaxHeight)); CSSNode node1 = new CSSNode(); node1.StyleMaxHeight = 100; node0.CopyStyle(node1); Assert.AreEqual(100, node0.StyleMaxHeight); }
public void TestMultiple() { CSSNode node = CSSNode.Create( positionType: CSSPositionType.Absolute, wrap: CSSWrap.Wrap, position: new Spacing(top: 6, right: 4), margin: new Spacing(bottom: 5, left: 3)); Assert.AreEqual(CSSFlexDirection.Column, node.FlexDirection); Assert.AreEqual(CSSPositionType.Absolute, node.PositionType); Assert.AreEqual(CSSWrap.Wrap, node.Wrap); Assert.AreEqual(6, node.GetPosition(CSSEdge.Top)); Assert.IsTrue(CSSConstants.IsUndefined(node.GetPosition(CSSEdge.Bottom))); Assert.AreEqual(4, node.GetPosition(CSSEdge.Right)); Assert.IsTrue(CSSConstants.IsUndefined(node.GetPosition(CSSEdge.Left))); Assert.AreEqual(0, node.GetMargin(CSSEdge.Top)); Assert.AreEqual(5, node.GetMargin(CSSEdge.Bottom)); Assert.AreEqual(3, node.GetMargin(CSSEdge.Left)); Assert.AreEqual(0, node.GetMargin(CSSEdge.Right)); }