diff --git a/core/test/src/com/google/zxing/common/AbstractBlackBoxTestCase.java b/core/test/src/com/google/zxing/common/AbstractBlackBoxTestCase.java index 94ccc5e0e..f31ea462c 100644 --- a/core/test/src/com/google/zxing/common/AbstractBlackBoxTestCase.java +++ b/core/test/src/com/google/zxing/common/AbstractBlackBoxTestCase.java @@ -49,8 +49,7 @@ public abstract class AbstractBlackBoxTestCase extends TestCase { private static final FilenameFilter IMAGE_NAME_FILTER = new FilenameFilter() { public boolean accept(File dir, String name) { String lowerCase = name.toLowerCase(); - return - lowerCase.endsWith(".jpg") || lowerCase.endsWith(".jpeg") || + return lowerCase.endsWith(".jpg") || lowerCase.endsWith(".jpeg") || lowerCase.endsWith(".gif") || lowerCase.endsWith(".png") || lowerCase.endsWith(".url"); } @@ -58,16 +57,16 @@ public abstract class AbstractBlackBoxTestCase extends TestCase { private final File testBase; private final Reader barcodeReader; - private final double passPercent; + private final int mustPassCount; private final BarcodeFormat expectedFormat; protected AbstractBlackBoxTestCase(File testBase, Reader barcodeReader, - double passPercent, + int mustPassCount, BarcodeFormat expectedFormat) { this.testBase = testBase; this.barcodeReader = barcodeReader; - this.passPercent = passPercent; + this.mustPassCount = mustPassCount; this.expectedFormat = expectedFormat; } @@ -99,8 +98,8 @@ public abstract class AbstractBlackBoxTestCase extends TestCase { assertEquals(expectedFormat, result.getBarcodeFormat()); String testImageFileName = testImage.getName(); - File expectedTextFile = - new File(testBase, testImageFileName.substring(0, testImageFileName.indexOf('.')) + ".txt"); + File expectedTextFile = new File(testBase, + testImageFileName.substring(0, testImageFileName.indexOf('.')) + ".txt"); String expectedText = readFileAsString(expectedTextFile); String resultText = result.getText(); @@ -116,16 +115,19 @@ public abstract class AbstractBlackBoxTestCase extends TestCase { result = barcodeReader.decode(source, TRY_HARDER_HINT); } catch (ReaderException re) { if (passed) { - fail("Normal mode succeed but \"try harder\" failed"); + fail("Normal mode succeeded but \"try harder\" failed"); } continue; } - assertEquals("Normal mode succeed but \"try harder\" failed", expectedFormat, result.getBarcodeFormat()); - assertEquals("Normal mode succeed but \"try harder\" failed", expectedText, result.getText()); + assertEquals("Normal mode succeeded but \"try harder\" failed", expectedFormat, + result.getBarcodeFormat()); + assertEquals("Normal mode succeeded but \"try harder\" failed", expectedText, + result.getText()); } - System.out.println(passedCount + " of " + imageFiles.length + " images passed"); - assertTrue("Too many images failed", passedCount >= (int) (imageFiles.length * passPercent)); + System.out.println(passedCount + " of " + imageFiles.length + " images passed (" + + mustPassCount + " required)"); + assertTrue("Too many images failed", passedCount >= mustPassCount); } private static String readFileAsString(File file) throws IOException { diff --git a/core/test/src/com/google/zxing/datamatrix/DataMatrixBlackBox1TestCase.java b/core/test/src/com/google/zxing/datamatrix/DataMatrixBlackBox1TestCase.java index 38204036e..f3e690a31 100644 --- a/core/test/src/com/google/zxing/datamatrix/DataMatrixBlackBox1TestCase.java +++ b/core/test/src/com/google/zxing/datamatrix/DataMatrixBlackBox1TestCase.java @@ -29,7 +29,7 @@ public final class DataMatrixBlackBox1TestCase extends AbstractBlackBoxTestCase public DataMatrixBlackBox1TestCase() { // TODO use MultiFormatReader here once Data Matrix decoder is done - super(new File("test/data/blackbox/datamatrix-1"), new DataMatrixReader(), 1.0, BarcodeFormat.DATAMATRIX); + super(new File("test/data/blackbox/datamatrix-1"), new DataMatrixReader(), 7, BarcodeFormat.DATAMATRIX); } } \ No newline at end of file diff --git a/core/test/src/com/google/zxing/oned/Code128BlackBox1TestCase.java b/core/test/src/com/google/zxing/oned/Code128BlackBox1TestCase.java index 5922e733e..c9fec32fe 100644 --- a/core/test/src/com/google/zxing/oned/Code128BlackBox1TestCase.java +++ b/core/test/src/com/google/zxing/oned/Code128BlackBox1TestCase.java @@ -28,7 +28,7 @@ import java.io.File; public final class Code128BlackBox1TestCase extends AbstractBlackBoxTestCase { public Code128BlackBox1TestCase() { - super(new File("test/data/blackbox/code128-1"), new MultiFormatReader(), 1.0, BarcodeFormat.CODE_128); + super(new File("test/data/blackbox/code128-1"), new MultiFormatReader(), 5, BarcodeFormat.CODE_128); } } \ No newline at end of file diff --git a/core/test/src/com/google/zxing/oned/Code39BlackBox1TestCase.java b/core/test/src/com/google/zxing/oned/Code39BlackBox1TestCase.java index 204c976e0..ee68b51e2 100644 --- a/core/test/src/com/google/zxing/oned/Code39BlackBox1TestCase.java +++ b/core/test/src/com/google/zxing/oned/Code39BlackBox1TestCase.java @@ -28,7 +28,7 @@ import java.io.File; public final class Code39BlackBox1TestCase extends AbstractBlackBoxTestCase { public Code39BlackBox1TestCase() { - super(new File("test/data/blackbox/code39-1"), new MultiFormatReader(), 1.0, BarcodeFormat.CODE_39); + super(new File("test/data/blackbox/code39-1"), new MultiFormatReader(), 4, BarcodeFormat.CODE_39); } } \ No newline at end of file diff --git a/core/test/src/com/google/zxing/oned/Code39ExtendedBlackBox2TestCase.java b/core/test/src/com/google/zxing/oned/Code39ExtendedBlackBox2TestCase.java index 55cbf59b5..270524e7d 100644 --- a/core/test/src/com/google/zxing/oned/Code39ExtendedBlackBox2TestCase.java +++ b/core/test/src/com/google/zxing/oned/Code39ExtendedBlackBox2TestCase.java @@ -27,7 +27,7 @@ import java.io.File; public final class Code39ExtendedBlackBox2TestCase extends AbstractBlackBoxTestCase { public Code39ExtendedBlackBox2TestCase() { - super(new File("test/data/blackbox/code39-2"), new Code39Reader(false, true), 1.0, BarcodeFormat.CODE_39); + super(new File("test/data/blackbox/code39-2"), new Code39Reader(false, true), 2, BarcodeFormat.CODE_39); } } \ No newline at end of file diff --git a/core/test/src/com/google/zxing/oned/EAN13BlackBox1TestCase.java b/core/test/src/com/google/zxing/oned/EAN13BlackBox1TestCase.java index d98db59ad..29fb9c2e7 100644 --- a/core/test/src/com/google/zxing/oned/EAN13BlackBox1TestCase.java +++ b/core/test/src/com/google/zxing/oned/EAN13BlackBox1TestCase.java @@ -28,7 +28,7 @@ import java.io.File; public final class EAN13BlackBox1TestCase extends AbstractBlackBoxTestCase { public EAN13BlackBox1TestCase() { - super(new File("test/data/blackbox/ean13-1"), new MultiFormatReader(), 0.66, BarcodeFormat.EAN_13); + super(new File("test/data/blackbox/ean13-1"), new MultiFormatReader(), 25, BarcodeFormat.EAN_13); } } \ No newline at end of file diff --git a/core/test/src/com/google/zxing/oned/EAN8BlackBox1TestCase.java b/core/test/src/com/google/zxing/oned/EAN8BlackBox1TestCase.java index 009a5470a..2cd3a1c8a 100644 --- a/core/test/src/com/google/zxing/oned/EAN8BlackBox1TestCase.java +++ b/core/test/src/com/google/zxing/oned/EAN8BlackBox1TestCase.java @@ -28,7 +28,7 @@ import java.io.File; public final class EAN8BlackBox1TestCase extends AbstractBlackBoxTestCase { public EAN8BlackBox1TestCase() { - super(new File("test/data/blackbox/ean8-1"), new MultiFormatReader(), 1.0, BarcodeFormat.EAN_8); + super(new File("test/data/blackbox/ean8-1"), new MultiFormatReader(), 8, BarcodeFormat.EAN_8); } } \ No newline at end of file diff --git a/core/test/src/com/google/zxing/oned/UPCABlackBox1TestCase.java b/core/test/src/com/google/zxing/oned/UPCABlackBox1TestCase.java index 7d099d433..9f3f0c0d6 100644 --- a/core/test/src/com/google/zxing/oned/UPCABlackBox1TestCase.java +++ b/core/test/src/com/google/zxing/oned/UPCABlackBox1TestCase.java @@ -28,7 +28,7 @@ import java.io.File; public final class UPCABlackBox1TestCase extends AbstractBlackBoxTestCase { public UPCABlackBox1TestCase() { - super(new File("test/data/blackbox/upca-1"), new MultiFormatReader(), 0.5, BarcodeFormat.UPC_A); + super(new File("test/data/blackbox/upca-1"), new MultiFormatReader(), 14, BarcodeFormat.UPC_A); } } \ No newline at end of file diff --git a/core/test/src/com/google/zxing/oned/UPCEBlackBox1TestCase.java b/core/test/src/com/google/zxing/oned/UPCEBlackBox1TestCase.java index c4c93c829..56c487e5d 100644 --- a/core/test/src/com/google/zxing/oned/UPCEBlackBox1TestCase.java +++ b/core/test/src/com/google/zxing/oned/UPCEBlackBox1TestCase.java @@ -28,7 +28,7 @@ import java.io.File; public final class UPCEBlackBox1TestCase extends AbstractBlackBoxTestCase { public UPCEBlackBox1TestCase() { - super(new File("test/data/blackbox/upce-1"), new MultiFormatReader(), 1.0, BarcodeFormat.UPC_E); + super(new File("test/data/blackbox/upce-1"), new MultiFormatReader(), 3, BarcodeFormat.UPC_E); } } \ No newline at end of file diff --git a/core/test/src/com/google/zxing/qrcode/QRCodeBlackBox1TestCase.java b/core/test/src/com/google/zxing/qrcode/QRCodeBlackBox1TestCase.java index 801f626eb..a0cdba912 100644 --- a/core/test/src/com/google/zxing/qrcode/QRCodeBlackBox1TestCase.java +++ b/core/test/src/com/google/zxing/qrcode/QRCodeBlackBox1TestCase.java @@ -28,7 +28,7 @@ import java.io.File; public final class QRCodeBlackBox1TestCase extends AbstractBlackBoxTestCase { public QRCodeBlackBox1TestCase() { - super(new File("test/data/blackbox/qrcode-1"), new MultiFormatReader(), 0.5, BarcodeFormat.QR_CODE); + super(new File("test/data/blackbox/qrcode-1"), new MultiFormatReader(), 16, BarcodeFormat.QR_CODE); } } \ No newline at end of file diff --git a/core/test/src/com/google/zxing/qrcode/QRCodeBlackBox2TestCase.java b/core/test/src/com/google/zxing/qrcode/QRCodeBlackBox2TestCase.java index f1ecdd5ae..4c2f0dc51 100644 --- a/core/test/src/com/google/zxing/qrcode/QRCodeBlackBox2TestCase.java +++ b/core/test/src/com/google/zxing/qrcode/QRCodeBlackBox2TestCase.java @@ -28,7 +28,7 @@ import java.io.File; public final class QRCodeBlackBox2TestCase extends AbstractBlackBoxTestCase { public QRCodeBlackBox2TestCase() { - super(new File("test/data/blackbox/qrcode-2"), new MultiFormatReader(), 1.0, BarcodeFormat.QR_CODE); + super(new File("test/data/blackbox/qrcode-2"), new MultiFormatReader(), 10, BarcodeFormat.QR_CODE); } } \ No newline at end of file