mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-22 19:58:49 +00:00
test: add tests for Point.IsOnLine and PointF.IsOnLine
This commit is contained in:
parent
6e7e162ffe
commit
8b768f824c
@ -7,6 +7,28 @@ namespace X10D.Tests.Drawing;
|
||||
[TestClass]
|
||||
public class PointFTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void IsOnLine_ShouldReturnTrue_GivenPointOnLine()
|
||||
{
|
||||
var point = new PointF(1.0f, 0.0f);
|
||||
var line = new LineF(PointF.Empty, new PointF(2.0f, 0.0f));
|
||||
|
||||
Assert.IsTrue(point.IsOnLine(line));
|
||||
Assert.IsTrue(point.IsOnLine(line.Start, line.End));
|
||||
Assert.IsTrue(point.IsOnLine(line.Start.ToVector2(), line.End.ToVector2()));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IsOnLine_ShouldReturnFalse_GivenPointNotOnLine()
|
||||
{
|
||||
var point = new PointF(1.0f, 1.0f);
|
||||
var line = new LineF(PointF.Empty, new PointF(2.0f, 0.0f));
|
||||
|
||||
Assert.IsFalse(point.IsOnLine(line));
|
||||
Assert.IsFalse(point.IsOnLine(line.Start, line.End));
|
||||
Assert.IsFalse(point.IsOnLine(line.Start.ToVector2(), line.End.ToVector2()));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Round_ShouldRoundToNearestInteger_GivenNoParameters()
|
||||
{
|
||||
|
@ -7,6 +7,28 @@ namespace X10D.Tests.Drawing;
|
||||
[TestClass]
|
||||
public class PointTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void IsOnLine_ShouldReturnTrue_GivenPointOnLine()
|
||||
{
|
||||
var point = new Point(1, 0);
|
||||
var line = new Line(Point.Empty, new Point(2, 0));
|
||||
|
||||
Assert.IsTrue(point.IsOnLine(line));
|
||||
Assert.IsTrue(point.IsOnLine(line.Start, line.End));
|
||||
Assert.IsTrue(point.IsOnLine(line.Start.ToVector2(), line.End.ToVector2()));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IsOnLine_ShouldReturnFalse_GivenPointNotOnLine()
|
||||
{
|
||||
var point = new Point(1, 1);
|
||||
var line = new Line(Point.Empty, new Point(2, 0));
|
||||
|
||||
Assert.IsFalse(point.IsOnLine(line));
|
||||
Assert.IsFalse(point.IsOnLine(line.Start, line.End));
|
||||
Assert.IsFalse(point.IsOnLine(line.Start.ToVector2(), line.End.ToVector2()));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void ToSize_ShouldReturnSize_WithEquivalentMembers()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user