Skip to content
Snippets Groups Projects
Commit 319a8159 authored by Luc Maisonobe's avatar Luc Maisonobe
Browse files

Clarified test.

parent 06e40c84
No related branches found
No related tags found
No related merge requests found
Pipeline #1589 passed
......@@ -814,10 +814,7 @@ public class Rugged {
}
// Check if the pixel is inside the sensor (with a margin) OR if the inverse location was impossible (null result)
if (sensorPixelGrid[uIndex][vIndex] != null &&
(sensorPixelGrid[uIndex][vIndex].getPixelNumber() < -INVLOC_MARGIN ||
sensorPixelGrid[uIndex][vIndex].getPixelNumber() > (INVLOC_MARGIN + sensor.getNbPixels() - 1)) ||
sensorPixelGrid[uIndex][vIndex] == null) {
if (!pixelIsInside(sensorPixelGrid[uIndex][vIndex], sensor)) {
// In order for the dump to end nicely
DumpManager.endNicely();
// Impossible to find the point in the given min line
......@@ -839,6 +836,15 @@ public class Rugged {
return sensorPixelGrid;
}
/** Check if pixel is inside the sensor with a margin.
* @param pixel pixel to check (may be null if not found)
* @param sensor the line sensor
* @return true if the pixel is inside the sensor
*/
private boolean pixelIsInside(final SensorPixel pixel, final LineSensor sensor) {
return pixel != null && pixel.getPixelNumber() >= -INVLOC_MARGIN && pixel.getPixelNumber() < INVLOC_MARGIN + sensor.getNbPixels() - 1;
}
/** Computation, for the sensor pixels grid, of the direct location WITH atmospheric refraction.
* (full computation)
* @param pixelGrid the pixel grid
......
......@@ -120,9 +120,29 @@ public class AtmosphericRefractionTest {
GeodeticPoint dummyGP = new GeodeticPoint(dummyLat, dummyLon, 0.);
try {
ruggedWith.inverseLocation(sensorName, dummyGP, minLine, maxLine);
Assert.fail("an exeption should have been thrown");
} catch (RuggedException re) {
Assert.assertEquals(RuggedMessages.INVALID_RANGE_FOR_LINES, re.getSpecifier());
}
try {
ruggedWith.inverseLocation(sensorName,
gpWithAtmosphericRefractionCorrection[0],
210, maxLine);
Assert.fail("an exeption should have been thrown");
} catch (RuggedException re) {
Assert.assertEquals(RuggedMessages.INVALID_RANGE_FOR_LINES, re.getSpecifier());
}
try {
ruggedWith.inverseLocation(sensorName,
gpWithAtmosphericRefractionCorrection[0],
minLine, 190);
Assert.fail("an exeption should have been thrown");
} catch (RuggedException re) {
Assert.assertEquals(RuggedMessages.INVALID_RANGE_FOR_LINES, re.getSpecifier());
}
}
private RuggedBuilder initRuggedForAtmosphericTests(final int dimension, final String sensorName) throws URISyntaxException {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment