Skip to content

Commit 4afd24a

Browse files
committed
Add test for issue #1, can't reproduce the problem.
1 parent f6c1c83 commit 4afd24a

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

TessBed/UnitTests.cs

+26
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,32 @@ public void Tesselate_WithThinQuad_DoesNotCrash()
7878
}
7979
}
8080

81+
[Test]
82+
// From https://github.com/speps/LibTessDotNet/issues/1
83+
public void Tesselate_WithSpecificQuad_ReturnsSameResultAsLibtess2()
84+
{
85+
string data = "50,50\n300,50\n300,200\n50,200";
86+
var indices = new List<int>();
87+
var expectedIndices = new int[] { 0, 1, 2, 1, 0, 3 };
88+
using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(data)))
89+
{
90+
var pset = DataLoader.LoadDat(stream);
91+
var tess = new Tess();
92+
PolyConvert.ToTess(pset, tess);
93+
tess.Tessellate(WindingRule.EvenOdd, ElementType.Polygons, 3);
94+
indices.Clear();
95+
for (int i = 0; i < tess.ElementCount; i++)
96+
{
97+
for (int j = 0; j < 3; j++)
98+
{
99+
int index = tess.Elements[i * 3 + j];
100+
indices.Add(index);
101+
}
102+
}
103+
Assert.AreEqual(expectedIndices, indices.ToArray());
104+
}
105+
}
106+
81107
[Test]
82108
public void Tesselate_CalledTwiceOnSameInstance_DoesNotCrash()
83109
{

0 commit comments

Comments
 (0)