Lap times and Gaps are tested (Gaps dont pass for now)
This commit is contained in:
@@ -16,7 +16,28 @@ namespace TrackTrends.Tests
|
|||||||
[TestMethod()]
|
[TestMethod()]
|
||||||
public void LapTimeOCR_Test()
|
public void LapTimeOCR_Test()
|
||||||
{
|
{
|
||||||
Assert.Fail();
|
string directory = @"./../../TestImages/LapTimes/";
|
||||||
|
foreach (string file in Directory.GetFiles(directory))
|
||||||
|
{
|
||||||
|
Bitmap image = (Bitmap)Image.FromFile(file);
|
||||||
|
DriverLapTimeWindow lapTimeWindow = new DriverLapTimeWindow(image,new Rectangle(0,0,image.Width,image.Height),true);
|
||||||
|
string[] paths = file.Split('/');
|
||||||
|
string fileName = paths[paths.Length - 1];
|
||||||
|
fileName = fileName.Replace(".png","");
|
||||||
|
|
||||||
|
int timeMS = (int)lapTimeWindow.DecodePng();
|
||||||
|
string time = Reader.ConvertMsToTime(timeMS);
|
||||||
|
|
||||||
|
string[] checkDigits = fileName.Split('_');
|
||||||
|
string[] digitsToCheck = time.Split(':');
|
||||||
|
|
||||||
|
Assert.AreEqual(checkDigits.Length, digitsToCheck.Length);
|
||||||
|
|
||||||
|
for(int i = 0; i < checkDigits.Length; i++)
|
||||||
|
{
|
||||||
|
Assert.AreEqual(checkDigits[i], digitsToCheck[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
[TestMethod()]
|
[TestMethod()]
|
||||||
public void PositionOCR_Test()
|
public void PositionOCR_Test()
|
||||||
@@ -26,7 +47,37 @@ namespace TrackTrends.Tests
|
|||||||
[TestMethod()]
|
[TestMethod()]
|
||||||
public void GapToLeaderOCR_Test()
|
public void GapToLeaderOCR_Test()
|
||||||
{
|
{
|
||||||
Assert.Fail();
|
string directory = @"./../../TestImages/Gaps/";
|
||||||
|
foreach (string file in Directory.GetFiles(directory))
|
||||||
|
{
|
||||||
|
Bitmap image = (Bitmap)Image.FromFile(file);
|
||||||
|
DriverLapTimeWindow lapTimeWindow = new DriverLapTimeWindow(image, new Rectangle(0, 0, image.Width, image.Height), true);
|
||||||
|
string[] paths = file.Split('/');
|
||||||
|
string fileName = paths[paths.Length - 1];
|
||||||
|
fileName = fileName.Replace(".png", "");
|
||||||
|
|
||||||
|
int timeMS = (int)lapTimeWindow.DecodePng();
|
||||||
|
string time = Reader.ConvertMsToTime(timeMS);
|
||||||
|
|
||||||
|
string[] checkDigits = fileName.Split('_');
|
||||||
|
string[] digitsToCheck = time.Split(':');
|
||||||
|
|
||||||
|
if (time == "0:00:000")
|
||||||
|
{
|
||||||
|
Assert.AreEqual(0, Convert.ToInt32(checkDigits[0]));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Assert.AreEqual(checkDigits.Length, digitsToCheck.Length);
|
||||||
|
|
||||||
|
for (int i = 0; i < checkDigits.Length; i++)
|
||||||
|
{
|
||||||
|
if (checkDigits[i] != digitsToCheck[i])
|
||||||
|
Console.Write("wut?");
|
||||||
|
Assert.AreEqual(checkDigits[i], digitsToCheck[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
[TestMethod()]
|
[TestMethod()]
|
||||||
public void DRS_OCR_Test()
|
public void DRS_OCR_Test()
|
||||||
|
|||||||
Reference in New Issue
Block a user