Add Edge Test for Polygon.Contains (#871)

* Added Assert for edge contains
Reference: https://github.com/craftworkgames/MonoGame.Extended/issues/214

* Renamed to PolygonTests
This commit is contained in:
Christopher Whitley
2024-05-27 17:58:54 -04:00
committed by GitHub
parent 49038f5d42
commit 89c8984079
@@ -4,7 +4,7 @@ using Xunit;
namespace MonoGame.Extended.Tests.Shapes
{
public class PolygonFTests
public class PolygonTests
{
[Fact]
public void Polygon_Contains_Point_Test()
@@ -24,6 +24,11 @@ namespace MonoGame.Extended.Tests.Shapes
Assert.True(polygon.Contains(new Vector2(9.99f, 9.99f)));
Assert.False(polygon.Contains(new Vector2(-1f, -1f)));
Assert.False(polygon.Contains(new Vector2(-11f, -11f)));
// Reference: https://github.com/craftworkgames/MonoGame.Extended/issues/214
// To maintain consistency with behavior in MonoGame, a point that exists at the edge of a polygon is
// -not- contained within the polygon and should return false
Assert.False(polygon.Contains(new Vector2(10.0f, 10.0f)));
}
[Fact]