Forgot pad left
This commit is contained in:
@ -370,6 +370,36 @@ public class UnitTestCalculations
|
||||
Assert.IsTrue(y.HasValue && y.Value == 641);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestGetPixelPercentageF()
|
||||
{
|
||||
int? x, y;
|
||||
int normalizedPixelPercentage;
|
||||
int bottom, height, left, right, top, width;
|
||||
string normalizedPixelPercentagePadded;
|
||||
width = 2048;
|
||||
height = 1365;
|
||||
normalizedPixelPercentagePadded = "617214031";
|
||||
(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 == 1264);
|
||||
Assert.IsTrue(y.Value == 192);
|
||||
left = x.Value;
|
||||
right = x.Value;
|
||||
top = y.Value;
|
||||
bottom = y.Value;
|
||||
normalizedPixelPercentage = ILocation.GetNormalizedPixelPercentage(bottom, height, left, Shared.Models.Stateless.ILocation.Digits, Shared.Models.Stateless.ILocation.Factor, right, top, width);
|
||||
Assert.IsTrue(normalizedPixelPercentage == 617214071);
|
||||
double x1, x2, y1, y2;
|
||||
x1 = x.Value;
|
||||
x2 = x.Value;
|
||||
y1 = y.Value;
|
||||
y2 = y.Value - 3;
|
||||
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