Now the positions are tested and pass
This commit is contained in:
@@ -20,10 +20,10 @@ namespace TrackTrends.Tests
|
|||||||
foreach (string file in Directory.GetFiles(directory))
|
foreach (string file in Directory.GetFiles(directory))
|
||||||
{
|
{
|
||||||
Bitmap image = (Bitmap)Image.FromFile(file);
|
Bitmap image = (Bitmap)Image.FromFile(file);
|
||||||
DriverLapTimeWindow lapTimeWindow = new DriverLapTimeWindow(image,new Rectangle(0,0,image.Width,image.Height),true);
|
DriverLapTimeWindow lapTimeWindow = new DriverLapTimeWindow(image, new Rectangle(0, 0, image.Width, image.Height), true);
|
||||||
string[] paths = file.Split('/');
|
string[] paths = file.Split('/');
|
||||||
string fileName = paths[paths.Length - 1];
|
string fileName = paths[paths.Length - 1];
|
||||||
fileName = fileName.Replace(".png","");
|
fileName = fileName.Replace(".png", "");
|
||||||
|
|
||||||
int timeMS = (int)lapTimeWindow.DecodePng();
|
int timeMS = (int)lapTimeWindow.DecodePng();
|
||||||
string time = Reader.ConvertMsToTime(timeMS);
|
string time = Reader.ConvertMsToTime(timeMS);
|
||||||
@@ -44,7 +44,19 @@ namespace TrackTrends.Tests
|
|||||||
[TestMethod()]
|
[TestMethod()]
|
||||||
public void PositionOCR_Test()
|
public void PositionOCR_Test()
|
||||||
{
|
{
|
||||||
Assert.Fail();
|
string directory = @"./../../TestImages/Positions/";
|
||||||
|
foreach (string file in Directory.GetFiles(directory))
|
||||||
|
{
|
||||||
|
Bitmap image = (Bitmap)Image.FromFile(file);
|
||||||
|
DriverPositionWindow posWindow = new DriverPositionWindow(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 foundPos = (int)posWindow.DecodePng();
|
||||||
|
|
||||||
|
Assert.AreEqual(Convert.ToInt32(fileName),foundPos);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
[TestMethod()]
|
[TestMethod()]
|
||||||
public void GapToLeaderOCR_Test()
|
public void GapToLeaderOCR_Test()
|
||||||
@@ -71,7 +83,7 @@ namespace TrackTrends.Tests
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
//The ConvertMSToTime will always return three chars so we need to make the checkDigits be also three chars
|
//The ConvertMSToTime will always return three chars so we need to make the checkDigits be also three chars
|
||||||
while(checkDigits.Length != 3)
|
while (checkDigits.Length != 3)
|
||||||
checkDigits = new[] { "0" }.Concat(checkDigits).ToArray();
|
checkDigits = new[] { "0" }.Concat(checkDigits).ToArray();
|
||||||
|
|
||||||
for (int i = 0; i < checkDigits.Length; i++)
|
for (int i = 0; i < checkDigits.Length; i++)
|
||||||
|
|||||||
Reference in New Issue
Block a user