Distance bug fix
This commit is contained in:
@ -435,6 +435,35 @@ public class UnitTestCalculations
|
||||
Assert.IsTrue(distance == 3);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestGetPixelPercentageG()
|
||||
{
|
||||
int? x, y;
|
||||
double x1, x2, y1, y2;
|
||||
int height, width;
|
||||
string normalizedPixelPercentagePadded;
|
||||
width = 4608;
|
||||
height = 3072;
|
||||
normalizedPixelPercentagePadded = "683152331";
|
||||
(x, y) = ILocation.GetXY(Shared.Models.Stateless.ILocation.Digits, Shared.Models.Stateless.ILocation.Factor, width, height, normalizedPixelPercentagePadded);
|
||||
if (x is null || y is null)
|
||||
throw new Exception();
|
||||
Assert.IsTrue(x.Value == 3148);
|
||||
Assert.IsTrue(y.Value == 1608);
|
||||
x1 = x.Value;
|
||||
y1 = y.Value;
|
||||
normalizedPixelPercentagePadded = "234431671";
|
||||
(x, y) = ILocation.GetXY(Shared.Models.Stateless.ILocation.Digits, Shared.Models.Stateless.ILocation.Factor, width, height, normalizedPixelPercentagePadded);
|
||||
if (x is null || y is null)
|
||||
throw new Exception();
|
||||
Assert.IsTrue(x.Value == 1080);
|
||||
Assert.IsTrue(y.Value == 973);
|
||||
x2 = x.Value;
|
||||
y2 = y.Value;
|
||||
double distance = Math.Sqrt(Math.Pow(x1 - x2, 2) + Math.Pow(y1 - y2, 2));
|
||||
Assert.IsTrue(distance == 3);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestGetDistance()
|
||||
{
|
||||
|
Reference in New Issue
Block a user