Fix Test Mode (#246)

* Fix test mode path and args

* spoooootless

* Fix unit test resources
This commit is contained in:
Banks T
2021-03-07 21:39:02 -05:00
committed by GitHub
parent ba8d2691fc
commit 129575dd23
6 changed files with 11 additions and 12 deletions

View File

@@ -135,7 +135,8 @@ public class TestUtils {
}
private static Path getResourcesFolderPath(boolean testMode) {
return Path.of("src", (testMode ? "main" : "test"), "resources").toAbsolutePath();
return Path.of((testMode ? "photon-server/src/main" : "src/test"), "resources")
.toAbsolutePath();
}
public static Path getTestMode2019ImagePath() {

View File

@@ -58,7 +58,7 @@ public class CirclePNPTest {
}
private CameraCalibrationCoefficients getCoeffs(String filename) {
var cameraCalibration = TestUtils.getCoeffs(filename, true);
var cameraCalibration = TestUtils.getCoeffs(filename, false);
checkCameraCoefficients(cameraCalibration);
return cameraCalibration;
}

View File

@@ -61,7 +61,7 @@ public class SolvePNPTest {
}
private CameraCalibrationCoefficients getCoeffs(String filename) {
var cameraCalibration = TestUtils.getCoeffs(filename, true);
var cameraCalibration = TestUtils.getCoeffs(filename, false);
checkCameraCoefficients(cameraCalibration);
return cameraCalibration;
}
@@ -106,7 +106,7 @@ public class SolvePNPTest {
TestUtils.getWPIImagePath(TestUtils.WPI2019Image.kCargoStraightDark48in, false),
TestUtils.WPI2019Image.FOV,
new Rotation2d(),
TestUtils.get2019LifeCamCoeffs(true));
TestUtils.get2019LifeCamCoeffs(false));
CVPipelineResult pipelineResult;
@@ -141,7 +141,7 @@ public class SolvePNPTest {
TestUtils.getWPIImagePath(TestUtils.WPI2020Image.kBlueGoal_224in_Left, false),
TestUtils.WPI2020Image.FOV,
new Rotation2d(),
TestUtils.get2020LifeCamCoeffs(true));
TestUtils.get2020LifeCamCoeffs(false));
CVPipelineResult pipelineResult = pipeline.run(frameProvider.get(), QuirkyCamera.DefaultCamera);
printTestResults(pipelineResult);

View File

@@ -57,13 +57,11 @@ public class Main {
final var options = new Options();
options.addOption("d", "debug", false, "Enable debug logging prints");
options.addOption("h", "help", false, "Show this help text and exit");
if (!isRelease) {
options.addOption(
"t",
"test-mode",
false,
"Run in test mode with 2019 and 2020 WPI field images in place of cameras");
}
options.addOption(
"t",
"test-mode",
false,
"Run in test mode with 2019 and 2020 WPI field images in place of cameras");
CommandLineParser parser = new DefaultParser();
CommandLine cmd = parser.parse(options, args);