Exemple #1
0
 public static YogaValue Percent(float value)
 {
     return(new YogaValue
     {
         value = value,
         unit = YogaConstants.IsUndefined(value) ? YogaUnit.Undefined : YogaUnit.Percent
     });
 }
Exemple #2
0
        public void TestCopyStyle()
        {
            YogaNode node0 = new YogaNode();

            Assert.IsTrue(YogaConstants.IsUndefined(node0.MaxHeight));

            YogaNode node1 = new YogaNode();

            node1.MaxHeight = 100;

            node0.CopyStyle(node1);
            Assert.AreEqual(100.Pt(), node0.MaxHeight);
        }
Exemple #3
0
        public void TestMultiple()
        {
            YogaNode node = YogaNode.Create(
                positionType: YogaPositionType.Absolute,
                wrap: YogaWrap.Wrap,
                position: new Spacing(top: 6, right: 4),
                margin: new Spacing(bottom: 5, left: 3));

            Assert.AreEqual(YogaFlexDirection.Column, node.FlexDirection);
            Assert.AreEqual(YogaPositionType.Absolute, node.PositionType);
            Assert.AreEqual(YogaWrap.Wrap, node.Wrap);
            Assert.AreEqual(6, node.GetPosition(YogaEdge.Top));
            Assert.IsTrue(YogaConstants.IsUndefined(node.GetPosition(YogaEdge.Bottom)));
            Assert.AreEqual(4, node.GetPosition(YogaEdge.Right));
            Assert.IsTrue(YogaConstants.IsUndefined(node.GetPosition(YogaEdge.Left)));
            Assert.AreEqual(0, node.GetMargin(YogaEdge.Top));
            Assert.AreEqual(5, node.GetMargin(YogaEdge.Bottom));
            Assert.AreEqual(3, node.GetMargin(YogaEdge.Left));
            Assert.AreEqual(0, node.GetMargin(YogaEdge.Right));
        }