Fix unit test

Summary: Fix #406 #407

Reviewed By: emilsjolander

Differential Revision: D4569680

fbshipit-source-id: a7b78674ed483d8619bd4aaa6e463203ef619c9b
This commit is contained in:
Kazuki Sakamoto
2017-02-16 07:26:41 -08:00
committed by Facebook Github Bot
parent ea8b7e0c91
commit 4d4db92a46
2 changed files with 32 additions and 32 deletions

View File

@@ -44,20 +44,20 @@ namespace Facebook.Yoga
BorderRightWidth = 16, BorderRightWidth = 16,
}; };
Assert.AreEqual(1.Px(), node.Top); Assert.AreEqual(1.Pt(), node.Top);
Assert.AreEqual(2.Px(), node.Bottom); Assert.AreEqual(2.Pt(), node.Bottom);
Assert.AreEqual(3.Px(), node.Left); Assert.AreEqual(3.Pt(), node.Left);
Assert.AreEqual(4.Px(), node.Right); Assert.AreEqual(4.Pt(), node.Right);
Assert.AreEqual(5.Px(), node.MarginTop); Assert.AreEqual(5.Pt(), node.MarginTop);
Assert.AreEqual(6.Px(), node.MarginBottom); Assert.AreEqual(6.Pt(), node.MarginBottom);
Assert.AreEqual(7.Px(), node.MarginLeft); Assert.AreEqual(7.Pt(), node.MarginLeft);
Assert.AreEqual(8.Px(), node.MarginRight); Assert.AreEqual(8.Pt(), node.MarginRight);
Assert.AreEqual(9.Px(), node.PaddingTop); Assert.AreEqual(9.Pt(), node.PaddingTop);
Assert.AreEqual(10.Px(), node.PaddingBottom); Assert.AreEqual(10.Pt(), node.PaddingBottom);
Assert.AreEqual(11.Px(), node.PaddingLeft); Assert.AreEqual(11.Pt(), node.PaddingLeft);
Assert.AreEqual(12.Px(), node.PaddingRight); Assert.AreEqual(12.Pt(), node.PaddingRight);
Assert.AreEqual(13, node.BorderTopWidth); Assert.AreEqual(13, node.BorderTopWidth);
Assert.AreEqual(14, node.BorderBottomWidth); Assert.AreEqual(14, node.BorderBottomWidth);
@@ -90,20 +90,20 @@ namespace Facebook.Yoga
node.BorderLeftWidth = 15; node.BorderLeftWidth = 15;
node.BorderRightWidth = 16; node.BorderRightWidth = 16;
Assert.AreEqual(1.Px(), node.Top); Assert.AreEqual(1.Pt(), node.Top);
Assert.AreEqual(2.Px(), node.Bottom); Assert.AreEqual(2.Pt(), node.Bottom);
Assert.AreEqual(3.Px(), node.Left); Assert.AreEqual(3.Pt(), node.Left);
Assert.AreEqual(4.Px(), node.Right); Assert.AreEqual(4.Pt(), node.Right);
Assert.AreEqual(5.Px(), node.MarginTop); Assert.AreEqual(5.Pt(), node.MarginTop);
Assert.AreEqual(6.Px(), node.MarginBottom); Assert.AreEqual(6.Pt(), node.MarginBottom);
Assert.AreEqual(7.Px(), node.MarginLeft); Assert.AreEqual(7.Pt(), node.MarginLeft);
Assert.AreEqual(8.Px(), node.MarginRight); Assert.AreEqual(8.Pt(), node.MarginRight);
Assert.AreEqual(9.Px(), node.PaddingTop); Assert.AreEqual(9.Pt(), node.PaddingTop);
Assert.AreEqual(10.Px(), node.PaddingBottom); Assert.AreEqual(10.Pt(), node.PaddingBottom);
Assert.AreEqual(11.Px(), node.PaddingLeft); Assert.AreEqual(11.Pt(), node.PaddingLeft);
Assert.AreEqual(12.Px(), node.PaddingRight); Assert.AreEqual(12.Pt(), node.PaddingRight);
Assert.AreEqual(13, node.BorderTopWidth); Assert.AreEqual(13, node.BorderTopWidth);
Assert.AreEqual(14, node.BorderBottomWidth); Assert.AreEqual(14, node.BorderBottomWidth);

View File

@@ -260,7 +260,7 @@ namespace Facebook.Yoga
parent.Insert(0, child0); parent.Insert(0, child0);
parent.Insert(0, child1); parent.Insert(0, child1);
parent.CalculateLayout(); parent.CalculateLayout();
Assert.AreEqual("{layout: {width: 100, height: 120, top: 0, left: 0}, flexDirection: 'column', alignItems: 'stretch', flexGrow: 0, flexShrink: 0, overflow: 'visible', width: 100px, height: 120px, children: [\n {layout: {width: 35, height: 45, top: 0, left: 0}, flexDirection: 'column', alignItems: 'stretch', flexGrow: 0, flexShrink: 0, overflow: 'visible', width: 35px, height: 45px, },\n {layout: {width: 30, height: 40, top: 45, left: 0}, flexDirection: 'column', alignItems: 'stretch', flexGrow: 0, flexShrink: 0, overflow: 'visible', width: 30px, height: 40px, },\n]},\n", parent.Print()); Assert.AreEqual("{layout: {width: 100, height: 120, top: 0, left: 0}, flexDirection: 'column', alignItems: 'stretch', flexGrow: 0, flexShrink: 0, flexBasis: 0%, overflow: 'visible', width: 100pt, height: 120pt, children: [\n {layout: {width: 35, height: 45, top: 0, left: 0}, flexDirection: 'column', alignItems: 'stretch', flexGrow: 0, flexShrink: 0, flexBasis: 0%, overflow: 'visible', width: 35pt, height: 45pt, },\n {layout: {width: 30, height: 40, top: 45, left: 0}, flexDirection: 'column', alignItems: 'stretch', flexGrow: 0, flexShrink: 0, flexBasis: 0%, overflow: 'visible', width: 30pt, height: 40pt, },\n]},\n", parent.Print());
} }
[Test] [Test]
@@ -273,7 +273,7 @@ namespace Facebook.Yoga
node1.MaxHeight = 100; node1.MaxHeight = 100;
node0.CopyStyle(node1); node0.CopyStyle(node1);
Assert.AreEqual(100.Px(), node0.MaxHeight); Assert.AreEqual(100.Pt(), node0.MaxHeight);
} }
[Test] [Test]
@@ -283,27 +283,27 @@ namespace Facebook.Yoga
node0.MaxWidth = 80; node0.MaxWidth = 80;
YogaNode node1 = new YogaNode(node0); YogaNode node1 = new YogaNode(node0);
Assert.AreEqual(80.Px(), node1.MaxWidth); Assert.AreEqual(80.Pt(), node1.MaxWidth);
YogaNode node2 = new YogaNode(node1) YogaNode node2 = new YogaNode(node1)
{ {
MaxHeight = 90, MaxHeight = 90,
}; };
Assert.AreEqual(80.Px(), node2.MaxWidth); Assert.AreEqual(80.Pt(), node2.MaxWidth);
Assert.AreEqual(90.Px(), node2.MaxHeight); Assert.AreEqual(90.Pt(), node2.MaxHeight);
YogaNode node3 = new YogaNode(node0) YogaNode node3 = new YogaNode(node0)
{ {
MaxWidth = 100, MaxWidth = 100,
}; };
Assert.AreEqual(100.Px(), node3.MaxWidth); Assert.AreEqual(100.Pt(), node3.MaxWidth);
YogaNode node4 = new YogaNode(node2) YogaNode node4 = new YogaNode(node2)
{ {
MaxWidth = 100, MaxWidth = 100,
}; };
Assert.AreEqual(100.Px(), node4.MaxWidth); Assert.AreEqual(100.Pt(), node4.MaxWidth);
Assert.AreEqual(90.Px(), node4.MaxHeight); Assert.AreEqual(90.Pt(), node4.MaxHeight);
} }
private void ForceGC() private void ForceGC()