Now the positions are tested and pass

This commit is contained in:
2023-06-01 12:52:05 +02:00
parent 9929a77b00
commit 963383b1cc
+13 -1
View File
@@ -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()