Names are now tested and all tests run
This commit is contained in:
@@ -55,7 +55,7 @@ namespace TrackTrends.Tests
|
|||||||
|
|
||||||
int foundPos = (int)posWindow.DecodePng();
|
int foundPos = (int)posWindow.DecodePng();
|
||||||
|
|
||||||
Assert.AreEqual(Convert.ToInt32(fileName),foundPos);
|
Assert.AreEqual(Convert.ToInt32(fileName), foundPos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[TestMethod()]
|
[TestMethod()]
|
||||||
@@ -99,8 +99,6 @@ namespace TrackTrends.Tests
|
|||||||
{
|
{
|
||||||
string directory = @"./../../TestImages/DRS/";
|
string directory = @"./../../TestImages/DRS/";
|
||||||
DirectoryInfo directoryInfo = new DirectoryInfo(directory);
|
DirectoryInfo directoryInfo = new DirectoryInfo(directory);
|
||||||
if (Directory.Exists(directory))
|
|
||||||
{
|
|
||||||
Bitmap falseExemple = (Bitmap)Image.FromFile(directory + "False.png");
|
Bitmap falseExemple = (Bitmap)Image.FromFile(directory + "False.png");
|
||||||
Bitmap trueExemple = (Bitmap)Image.FromFile(directory + "True.png");
|
Bitmap trueExemple = (Bitmap)Image.FromFile(directory + "True.png");
|
||||||
|
|
||||||
@@ -113,15 +111,48 @@ namespace TrackTrends.Tests
|
|||||||
Assert.IsFalse(falseResult);
|
Assert.IsFalse(falseResult);
|
||||||
Assert.IsTrue(trueResult);
|
Assert.IsTrue(trueResult);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
Assert.Fail();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
[TestMethod()]
|
[TestMethod()]
|
||||||
public void DriverNameOCR_Test()
|
public void DriverNameOCR_Test()
|
||||||
{
|
{
|
||||||
Assert.Fail();
|
string directory = @"./../../TestImages/Names/";
|
||||||
|
foreach (string file in Directory.GetFiles(directory))
|
||||||
|
{
|
||||||
|
Bitmap image = (Bitmap)Image.FromFile(file);
|
||||||
|
DriverNameWindow nameWindow = new DriverNameWindow(image, new Rectangle(0, 0, image.Width, image.Height), true);
|
||||||
|
string[] paths = file.Split('/');
|
||||||
|
string fileName = paths[paths.Length - 1];
|
||||||
|
fileName = fileName.Replace(".png", "");
|
||||||
|
|
||||||
|
List<string> driverList = new List<String>();
|
||||||
|
|
||||||
|
driverList.Add("Albon");
|
||||||
|
driverList.Add("Alonso");
|
||||||
|
driverList.Add("Bottas");
|
||||||
|
driverList.Add("De Vries");
|
||||||
|
driverList.Add("Gasly");
|
||||||
|
driverList.Add("Hamilton");
|
||||||
|
driverList.Add("Hulkenberg");
|
||||||
|
driverList.Add("Leclerc");
|
||||||
|
driverList.Add("Magnussen");
|
||||||
|
driverList.Add("Norris");
|
||||||
|
driverList.Add("Ocon");
|
||||||
|
driverList.Add("Perez");
|
||||||
|
driverList.Add("Piastri");
|
||||||
|
driverList.Add("Russel");
|
||||||
|
driverList.Add("Sainz");
|
||||||
|
driverList.Add("Sargeant");
|
||||||
|
driverList.Add("Stroll");
|
||||||
|
driverList.Add("Tsunoda");
|
||||||
|
driverList.Add("Verstappen");
|
||||||
|
driverList.Add("Zhou");
|
||||||
|
|
||||||
|
string foundName = (string)nameWindow.DecodePng(driverList);
|
||||||
|
//We only compare without the case because it does not really matter
|
||||||
|
//We remove the '_' from the file name for cases like "De Vries" wich obviously would be "De_Vries.png" as filename
|
||||||
|
fileName = fileName.Replace('_', ' ');
|
||||||
|
|
||||||
|
Assert.AreEqual(fileName.ToUpper(),foundName.ToUpper());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
[TestMethod()]
|
[TestMethod()]
|
||||||
public void SectorOCR_Test()
|
public void SectorOCR_Test()
|
||||||
@@ -130,7 +161,7 @@ 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);
|
||||||
DriverSectorWindow sectorsWindow = new DriverSectorWindow(image, new Rectangle(0, 0, image.Width, image.Height), 1,true);
|
DriverSectorWindow sectorsWindow = new DriverSectorWindow(image, new Rectangle(0, 0, image.Width, image.Height), 1, 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", "");
|
||||||
|
|||||||
Reference in New Issue
Block a user