"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "core/src/test/java/com/google/zxing/common/AbstractBlackBoxTestCase.java" between
zxing-zxing-3.4.1.tar.gz and zxing-zxing-3.5.0.tar.gz

About: ZXing ("zebra crossing") is a multi-format 1D/2D barcode image processing library implemented in Java, with ports to other languages. Info: Project is in maintenance mode (no active development).

AbstractBlackBoxTestCase.java  (zxing-zxing-3.4.1):AbstractBlackBoxTestCase.java  (zxing-zxing-3.5.0)
skipping to change at line 65 skipping to change at line 65
* @author dswitkin@google.com (Daniel Switkin) * @author dswitkin@google.com (Daniel Switkin)
*/ */
public abstract class AbstractBlackBoxTestCase extends Assert { public abstract class AbstractBlackBoxTestCase extends Assert {
private static final Logger log = Logger.getLogger(AbstractBlackBoxTestCase.cl ass.getSimpleName()); private static final Logger log = Logger.getLogger(AbstractBlackBoxTestCase.cl ass.getSimpleName());
private final Path testBase; private final Path testBase;
private final Reader barcodeReader; private final Reader barcodeReader;
private final BarcodeFormat expectedFormat; private final BarcodeFormat expectedFormat;
private final List<TestResult> testResults; private final List<TestResult> testResults;
private final EnumMap<DecodeHintType,Object> hints = new EnumMap<>(DecodeHintT ype.class);
public static Path buildTestBase(String testBasePathSuffix) { public static Path buildTestBase(String testBasePathSuffix) {
// A little workaround to prevent aggravation in my IDE // A little workaround to prevent aggravation in my IDE
Path testBase = Paths.get(testBasePathSuffix); Path testBase = Paths.get(testBasePathSuffix);
if (!Files.exists(testBase)) { if (!Files.exists(testBase)) {
// try starting with 'core' since the test base is often given as the proj ect root // try starting with 'core' since the test base is often given as the proj ect root
testBase = Paths.get("core").resolve(testBasePathSuffix); testBase = Paths.get("core").resolve(testBasePathSuffix);
} }
return testBase; return testBase;
} }
skipping to change at line 95 skipping to change at line 96
} }
protected final Path getTestBase() { protected final Path getTestBase() {
return testBase; return testBase;
} }
protected final void addTest(int mustPassCount, int tryHarderCount, float rota tion) { protected final void addTest(int mustPassCount, int tryHarderCount, float rota tion) {
addTest(mustPassCount, tryHarderCount, 0, 0, rotation); addTest(mustPassCount, tryHarderCount, 0, 0, rotation);
} }
protected void addHint(DecodeHintType hint) {
hints.put(hint, Boolean.TRUE);
}
/** /**
* Adds a new test for the current directory of images. * Adds a new test for the current directory of images.
* *
* @param mustPassCount The number of images which must decode for the test to pass. * @param mustPassCount The number of images which must decode for the test to pass.
* @param tryHarderCount The number of images which must pass using the try ha rder flag. * @param tryHarderCount The number of images which must pass using the try ha rder flag.
* @param maxMisreads Maximum number of images which can fail due to successfu lly reading the wrong contents * @param maxMisreads Maximum number of images which can fail due to successfu lly reading the wrong contents
* @param maxTryHarderMisreads Maximum number of images which can fail due to successfully * @param maxTryHarderMisreads Maximum number of images which can fail due to successfully
* reading the wrong contents using the try harder flag * reading the wrong contents using the try harder flag
* @param rotation The rotation in degrees clockwise to use for this test. * @param rotation The rotation in degrees clockwise to use for this test.
*/ */
skipping to change at line 255 skipping to change at line 260
} }
private boolean decode(BinaryBitmap source, private boolean decode(BinaryBitmap source,
float rotation, float rotation,
String expectedText, String expectedText,
Map<?,?> expectedMetadata, Map<?,?> expectedMetadata,
boolean tryHarder) throws ReaderException { boolean tryHarder) throws ReaderException {
String suffix = String.format(" (%srotation: %d)", tryHarder ? "try harder, " : "", (int) rotation); String suffix = String.format(" (%srotation: %d)", tryHarder ? "try harder, " : "", (int) rotation);
Map<DecodeHintType,Object> hints = new EnumMap<>(DecodeHintType.class); Map<DecodeHintType,Object> hints = this.hints.clone();
if (tryHarder) { if (tryHarder) {
hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE); hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
} }
// Try in 'pure' mode mostly to exercise PURE_BARCODE code paths for excepti ons; // Try in 'pure' mode mostly to exercise PURE_BARCODE code paths for excepti ons;
// not expected to pass, generally // not expected to pass, generally
Result result = null; Result result = null;
try { try {
Map<DecodeHintType,Object> pureHints = new EnumMap<>(hints); Map<DecodeHintType,Object> pureHints = new EnumMap<>(hints);
pureHints.put(DecodeHintType.PURE_BARCODE, Boolean.TRUE); pureHints.put(DecodeHintType.PURE_BARCODE, Boolean.TRUE);
 End of changes. 3 change blocks. 
1 lines changed or deleted 6 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)