moving aroudn test cases for integration

This commit is contained in:
Henry Schimke
2022-08-31 13:32:56 -05:00
parent bafd0663a4
commit aae5684127
79 changed files with 0 additions and 516 deletions

BIN
java_test/java/com/google/.DS_Store vendored Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,35 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.aztec;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* @author David Olivier
*/
public final class AztecBlackBox1TestCase extends AbstractBlackBoxTestCase {
public AztecBlackBox1TestCase() {
super("src/test/resources/blackbox/aztec-1", new AztecReader(), BarcodeFormat.AZTEC);
addTest(14, 14, 0.0f);
addTest(14, 14, 90.0f);
addTest(14, 14, 180.0f);
addTest(14, 14, 270.0f);
}
}

View File

@@ -1,37 +0,0 @@
/*
* Copyright 2011 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.aztec;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* A test of Aztec barcodes under real world lighting conditions, taken with a mobile phone.
*
* @author dswitkin@google.com (Daniel Switkin)
*/
public final class AztecBlackBox2TestCase extends AbstractBlackBoxTestCase {
public AztecBlackBox2TestCase() {
super("src/test/resources/blackbox/aztec-2", new AztecReader(), BarcodeFormat.AZTEC);
addTest(5, 5, 0.0f);
addTest(4, 4, 90.0f);
addTest(6, 6, 180.0f);
addTest(3, 3, 270.0f);
}
}

Binary file not shown.

Binary file not shown.

View File

@@ -1,357 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.common;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.BinaryBitmap;
import com.google.zxing.BufferedImageLuminanceSource;
import com.google.zxing.DecodeHintType;
import com.google.zxing.LuminanceSource;
import com.google.zxing.Reader;
import com.google.zxing.ReaderException;
import com.google.zxing.RXingResult;
import com.google.zxing.RXingResultMetadataType;
import org.junit.Assert;
import org.junit.Test;
import javax.imageio.ImageIO;
import java.awt.Graphics;
import java.awt.geom.AffineTransform;
import java.awt.geom.RectangularShape;
import java.awt.image.AffineTransformOp;
import java.awt.image.BufferedImage;
import java.awt.image.BufferedImageOp;
import java.io.BufferedReader;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.EnumMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.logging.Logger;
/**
* @author Sean Owen
* @author dswitkin@google.com (Daniel Switkin)
*/
public abstract class AbstractBlackBoxTestCase extends Assert {
private static final Logger log = Logger.getLogger(AbstractBlackBoxTestCase.class.getSimpleName());
private final Path testBase;
private final Reader barcodeReader;
private final BarcodeFormat expectedFormat;
private final List<TestRXingResult> testRXingResults;
private final EnumMap<DecodeHintType,Object> hints = new EnumMap<>(DecodeHintType.class);
public static Path buildTestBase(String testBasePathSuffix) {
// A little workaround to prevent aggravation in my IDE
Path testBase = Paths.get(testBasePathSuffix);
if (!Files.exists(testBase)) {
// try starting with 'core' since the test base is often given as the project root
testBase = Paths.get("core").resolve(testBasePathSuffix);
}
return testBase;
}
protected AbstractBlackBoxTestCase(String testBasePathSuffix,
Reader barcodeReader,
BarcodeFormat expectedFormat) {
this.testBase = buildTestBase(testBasePathSuffix);
this.barcodeReader = barcodeReader;
this.expectedFormat = expectedFormat;
testRXingResults = new ArrayList<>();
System.setProperty("java.util.logging.SimpleFormatter.format", "%4$s: %5$s%6$s%n");
}
protected final Path getTestBase() {
return testBase;
}
protected final void addTest(int mustPassCount, int tryHarderCount, float 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.
*
* @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 harder flag.
* @param maxMisreads Maximum number of images which can fail due to successfully reading the wrong contents
* @param maxTryHarderMisreads Maximum number of images which can fail due to successfully
* reading the wrong contents using the try harder flag
* @param rotation The rotation in degrees clockwise to use for this test.
*/
protected final void addTest(int mustPassCount,
int tryHarderCount,
int maxMisreads,
int maxTryHarderMisreads,
float rotation) {
testRXingResults.add(new TestRXingResult(mustPassCount, tryHarderCount, maxMisreads, maxTryHarderMisreads, rotation));
}
protected final List<Path> getImageFiles() throws IOException {
assertTrue("Please download and install test images, and run from the 'core' directory", Files.exists(testBase));
List<Path> paths = new ArrayList<>();
try (DirectoryStream<Path> pathIt = Files.newDirectoryStream(testBase, "*.{jpg,jpeg,gif,png,JPG,JPEG,GIF,PNG}")) {
for (Path path : pathIt) {
paths.add(path);
}
}
return paths;
}
final Reader getReader() {
return barcodeReader;
}
@Test
public void testBlackBox() throws IOException {
assertFalse(testRXingResults.isEmpty());
List<Path> imageFiles = getImageFiles();
int testCount = testRXingResults.size();
int[] passedCounts = new int[testCount];
int[] misreadCounts = new int[testCount];
int[] tryHarderCounts = new int[testCount];
int[] tryHarderMisreadCounts = new int[testCount];
for (Path testImage : imageFiles) {
log.info(String.format("Starting %s", testImage));
BufferedImage image = ImageIO.read(testImage.toFile());
String testImageFileName = testImage.getFileName().toString();
String fileBaseName = testImageFileName.substring(0, testImageFileName.indexOf('.'));
Path expectedTextFile = testBase.resolve(fileBaseName + ".txt");
String expectedText;
if (Files.exists(expectedTextFile)) {
expectedText = readFileAsString(expectedTextFile, StandardCharsets.UTF_8);
} else {
expectedTextFile = testBase.resolve(fileBaseName + ".bin");
assertTrue(Files.exists(expectedTextFile));
expectedText = readFileAsString(expectedTextFile, StandardCharsets.ISO_8859_1);
}
Path expectedMetadataFile = testBase.resolve(fileBaseName + ".metadata.txt");
Properties expectedMetadata = new Properties();
if (Files.exists(expectedMetadataFile)) {
try (BufferedReader reader = Files.newBufferedReader(expectedMetadataFile, StandardCharsets.UTF_8)) {
expectedMetadata.load(reader);
}
}
for (int x = 0; x < testCount; x++) {
float rotation = testRXingResults.get(x).getRotation();
BufferedImage rotatedImage = rotateImage(image, rotation);
LuminanceSource source = new BufferedImageLuminanceSource(rotatedImage);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
try {
if (decode(bitmap, rotation, expectedText, expectedMetadata, false)) {
passedCounts[x]++;
} else {
misreadCounts[x]++;
}
} catch (ReaderException ignored) {
log.fine(String.format("could not read at rotation %f", rotation));
}
try {
if (decode(bitmap, rotation, expectedText, expectedMetadata, true)) {
tryHarderCounts[x]++;
} else {
tryHarderMisreadCounts[x]++;
}
} catch (ReaderException ignored) {
log.fine(String.format("could not read at rotation %f w/TH", rotation));
}
}
}
// Print the results of all tests first
int totalFound = 0;
int totalMustPass = 0;
int totalMisread = 0;
int totalMaxMisread = 0;
for (int x = 0; x < testRXingResults.size(); x++) {
TestRXingResult testRXingResult = testRXingResults.get(x);
log.info(String.format("Rotation %d degrees:", (int) testRXingResult.getRotation()));
log.info(String.format(" %d of %d images passed (%d required)",
passedCounts[x], imageFiles.size(), testRXingResult.getMustPassCount()));
int failed = imageFiles.size() - passedCounts[x];
log.info(String.format(" %d failed due to misreads, %d not detected",
misreadCounts[x], failed - misreadCounts[x]));
log.info(String.format(" %d of %d images passed with try harder (%d required)",
tryHarderCounts[x], imageFiles.size(), testRXingResult.getTryHarderCount()));
failed = imageFiles.size() - tryHarderCounts[x];
log.info(String.format(" %d failed due to misreads, %d not detected",
tryHarderMisreadCounts[x], failed - tryHarderMisreadCounts[x]));
totalFound += passedCounts[x] + tryHarderCounts[x];
totalMustPass += testRXingResult.getMustPassCount() + testRXingResult.getTryHarderCount();
totalMisread += misreadCounts[x] + tryHarderMisreadCounts[x];
totalMaxMisread += testRXingResult.getMaxMisreads() + testRXingResult.getMaxTryHarderMisreads();
}
int totalTests = imageFiles.size() * testCount * 2;
log.info(String.format("Decoded %d images out of %d (%d%%, %d required)",
totalFound, totalTests, totalFound * 100 / totalTests, totalMustPass));
if (totalFound > totalMustPass) {
log.warning(String.format("+++ Test too lax by %d images", totalFound - totalMustPass));
} else if (totalFound < totalMustPass) {
log.warning(String.format("--- Test failed by %d images", totalMustPass - totalFound));
}
if (totalMisread < totalMaxMisread) {
log.warning(String.format("+++ Test expects too many misreads by %d images", totalMaxMisread - totalMisread));
} else if (totalMisread > totalMaxMisread) {
log.warning(String.format("--- Test had too many misreads by %d images", totalMisread - totalMaxMisread));
}
// Then run through again and assert if any failed
for (int x = 0; x < testCount; x++) {
TestRXingResult testRXingResult = testRXingResults.get(x);
String label = "Rotation " + testRXingResult.getRotation() + " degrees: Too many images failed";
assertTrue(label,
passedCounts[x] >= testRXingResult.getMustPassCount());
assertTrue("Try harder, " + label,
tryHarderCounts[x] >= testRXingResult.getTryHarderCount());
label = "Rotation " + testRXingResult.getRotation() + " degrees: Too many images misread";
assertTrue(label,
misreadCounts[x] <= testRXingResult.getMaxMisreads());
assertTrue("Try harder, " + label,
tryHarderMisreadCounts[x] <= testRXingResult.getMaxTryHarderMisreads());
}
}
private boolean decode(BinaryBitmap source,
float rotation,
String expectedText,
Map<?,?> expectedMetadata,
boolean tryHarder) throws ReaderException {
String suffix = String.format(" (%srotation: %d)", tryHarder ? "try harder, " : "", (int) rotation);
Map<DecodeHintType,Object> hints = this.hints.clone();
if (tryHarder) {
hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
}
// Try in 'pure' mode mostly to exercise PURE_BARCODE code paths for exceptions;
// not expected to pass, generally
RXingResult result = null;
try {
Map<DecodeHintType,Object> pureHints = new EnumMap<>(hints);
pureHints.put(DecodeHintType.PURE_BARCODE, Boolean.TRUE);
result = barcodeReader.decode(source, pureHints);
} catch (ReaderException re) {
// continue
}
if (result == null) {
result = barcodeReader.decode(source, hints);
}
if (expectedFormat != result.getBarcodeFormat()) {
log.info(String.format("Format mismatch: expected '%s' but got '%s'%s",
expectedFormat, result.getBarcodeFormat(), suffix));
return false;
}
String resultText = result.getText();
if (!expectedText.equals(resultText)) {
log.info(String.format("Content mismatch: expected '%s' but got '%s'%s",
expectedText, resultText, suffix));
return false;
}
Map<RXingResultMetadataType,?> resultMetadata = result.getRXingResultMetadata();
for (Map.Entry<?,?> metadatum : expectedMetadata.entrySet()) {
RXingResultMetadataType key = RXingResultMetadataType.valueOf(metadatum.getKey().toString());
Object expectedValue = metadatum.getValue();
Object actualValue = resultMetadata == null ? null : resultMetadata.get(key);
if (!expectedValue.equals(actualValue)) {
log.info(String.format("Metadata mismatch for key '%s': expected '%s' but got '%s'",
key, expectedValue, actualValue));
return false;
}
}
return true;
}
protected static String readFileAsString(Path file, Charset charset) throws IOException {
String stringContents = new String(Files.readAllBytes(file), charset);
if (stringContents.endsWith("\n")) {
log.info("String contents of file " + file + " end with a newline. " +
"This may not be intended and cause a test failure");
}
return stringContents;
}
protected static BufferedImage rotateImage(BufferedImage original, float degrees) {
if (degrees == 0.0f) {
return original;
}
switch (original.getType()) {
case BufferedImage.TYPE_BYTE_INDEXED:
case BufferedImage.TYPE_BYTE_BINARY:
BufferedImage argb = new BufferedImage(original.getWidth(),
original.getHeight(),
BufferedImage.TYPE_INT_ARGB);
Graphics g = argb.createGraphics();
g.drawImage(original, 0, 0, null);
g.dispose();
original = argb;
break;
}
double radians = Math.toRadians(degrees);
// Transform simply to find out the new bounding box (don't actually run the image through it)
AffineTransform at = new AffineTransform();
at.rotate(radians, original.getWidth() / 2.0, original.getHeight() / 2.0);
BufferedImageOp op = new AffineTransformOp(at, AffineTransformOp.TYPE_BICUBIC);
RectangularShape r = op.getBounds2D(original);
int width = (int) Math.ceil(r.getWidth());
int height = (int) Math.ceil(r.getHeight());
// Real transform, now that we know the size of the new image and how to translate after we rotate
// to keep it centered
at = new AffineTransform();
at.rotate(radians, width / 2.0, height / 2.0);
at.translate((width - original.getWidth()) / 2.0,
(height - original.getHeight()) / 2.0);
op = new AffineTransformOp(at, AffineTransformOp.TYPE_BICUBIC);
return op.filter(original, new BufferedImage(width, height, original.getType()));
}
}

View File

@@ -1,159 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.common;
import com.google.zxing.BinaryBitmap;
import com.google.zxing.BufferedImageLuminanceSource;
import com.google.zxing.DecodeHintType;
import com.google.zxing.LuminanceSource;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.ReaderException;
import com.google.zxing.RXingResult;
import org.junit.Test;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.EnumMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
/**
* This abstract class looks for negative results, i.e. it only allows a certain number of false
* positives in images which should not decode. This helps ensure that we are not too lenient.
*
* @author dswitkin@google.com (Daniel Switkin)
*/
public abstract class AbstractNegativeBlackBoxTestCase extends AbstractBlackBoxTestCase {
private static final Logger log = Logger.getLogger(AbstractNegativeBlackBoxTestCase.class.getSimpleName());
private final List<TestRXingResult> testRXingResults;
private static final class TestRXingResult {
private final int falsePositivesAllowed;
private final float rotation;
TestRXingResult(int falsePositivesAllowed, float rotation) {
this.falsePositivesAllowed = falsePositivesAllowed;
this.rotation = rotation;
}
int getFalsePositivesAllowed() {
return falsePositivesAllowed;
}
float getRotation() {
return rotation;
}
}
// Use the multiformat reader to evaluate all decoders in the system.
protected AbstractNegativeBlackBoxTestCase(String testBasePathSuffix) {
super(testBasePathSuffix, new MultiFormatReader(), null);
testRXingResults = new ArrayList<>();
}
protected final void addTest(int falsePositivesAllowed, float rotation) {
testRXingResults.add(new TestRXingResult(falsePositivesAllowed, rotation));
}
@Override
@Test
public void testBlackBox() throws IOException {
assertFalse(testRXingResults.isEmpty());
List<Path> imageFiles = getImageFiles();
int[] falsePositives = new int[testRXingResults.size()];
for (Path testImage : imageFiles) {
log.info(String.format("Starting %s", testImage));
BufferedImage image = ImageIO.read(testImage.toFile());
if (image == null) {
throw new IOException("Could not read image: " + testImage);
}
for (int x = 0; x < testRXingResults.size(); x++) {
TestRXingResult testRXingResult = testRXingResults.get(x);
if (!checkForFalsePositives(image, testRXingResult.getRotation())) {
falsePositives[x]++;
}
}
}
int totalFalsePositives = 0;
int totalAllowed = 0;
for (int x = 0; x < testRXingResults.size(); x++) {
TestRXingResult testRXingResult = testRXingResults.get(x);
totalFalsePositives += falsePositives[x];
totalAllowed += testRXingResult.getFalsePositivesAllowed();
}
if (totalFalsePositives < totalAllowed) {
log.warning(String.format("+++ Test too lax by %d images", totalAllowed - totalFalsePositives));
} else if (totalFalsePositives > totalAllowed) {
log.warning(String.format("--- Test failed by %d images", totalFalsePositives - totalAllowed));
}
for (int x = 0; x < testRXingResults.size(); x++) {
TestRXingResult testRXingResult = testRXingResults.get(x);
log.info(String.format("Rotation %d degrees: %d of %d images were false positives (%d allowed)",
(int) testRXingResult.getRotation(), falsePositives[x], imageFiles.size(),
testRXingResult.getFalsePositivesAllowed()));
assertTrue("Rotation " + testRXingResult.getRotation() + " degrees: Too many false positives found",
falsePositives[x] <= testRXingResult.getFalsePositivesAllowed());
}
}
/**
* Make sure ZXing does NOT find a barcode in the image.
*
* @param image The image to test
* @param rotationInDegrees The amount of rotation to apply
* @return true if nothing found, false if a non-existent barcode was detected
*/
private boolean checkForFalsePositives(BufferedImage image, float rotationInDegrees) {
BufferedImage rotatedImage = rotateImage(image, rotationInDegrees);
LuminanceSource source = new BufferedImageLuminanceSource(rotatedImage);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
RXingResult result;
try {
result = getReader().decode(bitmap);
log.info(String.format("Found false positive: '%s' with format '%s' (rotation: %d)",
result.getText(), result.getBarcodeFormat(), (int) rotationInDegrees));
return false;
} catch (ReaderException re) {
// continue
}
// Try "try harder" getMode
Map<DecodeHintType,Object> hints = new EnumMap<>(DecodeHintType.class);
hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
try {
result = getReader().decode(bitmap, hints);
log.info(String.format("Try harder found false positive: '%s' with format '%s' (rotation: %d)",
result.getText(), result.getBarcodeFormat(), (int) rotationInDegrees));
return false;
} catch (ReaderException re) {
// continue
}
return true;
}
}

Binary file not shown.

View File

@@ -1,36 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.datamatrix;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* @author bbrown@google.com (Brian Brown)
*/
public final class DataMatrixBlackBox1TestCase extends AbstractBlackBoxTestCase {
public DataMatrixBlackBox1TestCase() {
super("src/test/resources/blackbox/datamatrix-1", new MultiFormatReader(), BarcodeFormat.DATA_MATRIX);
addTest(21, 21, 0.0f);
addTest(21, 21, 90.0f);
addTest(21, 21, 180.0f);
addTest(21, 21, 270.0f);
}
}

View File

@@ -1,36 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.datamatrix;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* @author dswitkin@google.com (Daniel Switkin)
*/
public final class DataMatrixBlackBox2TestCase extends AbstractBlackBoxTestCase {
public DataMatrixBlackBox2TestCase() {
super("src/test/resources/blackbox/datamatrix-2", new MultiFormatReader(), BarcodeFormat.DATA_MATRIX);
addTest(13, 13, 0, 1, 0.0f);
addTest(15, 15, 0, 1, 90.0f);
addTest(17, 16, 0, 1, 180.0f);
addTest(15, 15, 0, 1, 270.0f);
}
}

View File

@@ -1,36 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.datamatrix;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* @author gitlost
*/
public final class DataMatrixBlackBox3TestCase extends AbstractBlackBoxTestCase {
public DataMatrixBlackBox3TestCase() {
super("src/test/resources/blackbox/datamatrix-3", new MultiFormatReader(), BarcodeFormat.DATA_MATRIX);
addTest(18, 18, 0.0f);
addTest(17, 17, 90.0f);
addTest(18, 18, 180.0f);
addTest(18, 18, 270.0f);
}
}

View File

@@ -1,38 +0,0 @@
/*
* Copyright 2022 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.maxicode;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.DecodeHintType;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* Tests all characters in Set A.
*
* @author Daniel Gredler
* @see <a href="https://github.com/zxing/zxing/issues/1543">Defect 1543</a>
*/
public final class MaxiCodeBlackBox1TestCase extends AbstractBlackBoxTestCase {
public MaxiCodeBlackBox1TestCase() {
super("src/test/resources/blackbox/maxicode-1", new MultiFormatReader(), BarcodeFormat.MAXICODE);
addHint(DecodeHintType.PURE_BARCODE);
addTest(1, 1, 0.0f);
}
}

View File

@@ -1,33 +0,0 @@
/*
* Copyright 2016 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.maxicode;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* Tests {@link MaxiCodeReader} against a fixed set of test images.
*/
public final class Maxicode1TestCase extends AbstractBlackBoxTestCase {
public Maxicode1TestCase() {
super("src/test/resources/blackbox/maxicode-1", new MultiFormatReader(), BarcodeFormat.MAXICODE);
addTest(6, 6, 0.0f);
}
}

Binary file not shown.

View File

@@ -1,36 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.negative;
import com.google.zxing.common.AbstractNegativeBlackBoxTestCase;
/**
* Additional random images with high contrast patterns which should not find any barcodes.
*
* @author dswitkin@google.com (Daniel Switkin)
*/
public final class FalsePositives2BlackBoxTestCase extends AbstractNegativeBlackBoxTestCase {
public FalsePositives2BlackBoxTestCase() {
super("src/test/resources/blackbox/falsepositives-2");
addTest(4, 0.0f);
addTest(4, 90.0f);
addTest(4, 180.0f);
addTest(4, 270.0f);
}
}

View File

@@ -1,36 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.negative;
import com.google.zxing.common.AbstractNegativeBlackBoxTestCase;
/**
* This test ensures that random images with high contrast patterns do not decode as barcodes.
*
* @author dswitkin@google.com (Daniel Switkin)
*/
public final class FalsePositivesBlackBoxTestCase extends AbstractNegativeBlackBoxTestCase {
public FalsePositivesBlackBoxTestCase() {
super("src/test/resources/blackbox/falsepositives");
addTest(2, 0.0f);
addTest(2, 90.0f);
addTest(2, 180.0f);
addTest(2, 270.0f);
}
}

View File

@@ -1,36 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.negative;
import com.google.zxing.common.AbstractNegativeBlackBoxTestCase;
/**
* This test ensures that partial barcodes do not decode.
*
* @author dswitkin@google.com (Daniel Switkin)
*/
public final class PartialBlackBoxTestCase extends AbstractNegativeBlackBoxTestCase {
public PartialBlackBoxTestCase() {
super("src/test/resources/blackbox/partial");
addTest(1, 0.0f);
addTest(1, 90.0f);
addTest(1, 180.0f);
addTest(1, 270.0f);
}
}

View File

@@ -1,36 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.negative;
import com.google.zxing.common.AbstractNegativeBlackBoxTestCase;
/**
* This test ensures that unsupported barcodes do not decode.
*
* @author dswitkin@google.com (Daniel Switkin)
*/
public final class UnsupportedBlackBoxTestCase extends AbstractNegativeBlackBoxTestCase {
public UnsupportedBlackBoxTestCase() {
super("src/test/resources/blackbox/unsupported");
addTest(0, 0.0f);
addTest(0, 90.0f);
addTest(0, 180.0f);
addTest(0, 270.0f);
}
}

Binary file not shown.

View File

@@ -1,34 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* @author Sean Owen
*/
public final class CodabarBlackBox1TestCase extends AbstractBlackBoxTestCase {
public CodabarBlackBox1TestCase() {
super("src/test/resources/blackbox/codabar-1", new MultiFormatReader(), BarcodeFormat.CODABAR);
addTest(11, 11, 0.0f);
addTest(11, 11, 180.0f);
}
}

View File

@@ -1,34 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* @author Sean Owen
*/
public final class Code128BlackBox1TestCase extends AbstractBlackBoxTestCase {
public Code128BlackBox1TestCase() {
super("src/test/resources/blackbox/code128-1", new MultiFormatReader(), BarcodeFormat.CODE_128);
addTest(6, 6, 0.0f);
addTest(6, 6, 180.0f);
}
}

View File

@@ -1,34 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* @author dswitkin@google.com (Daniel Switkin)
*/
public final class Code128BlackBox2TestCase extends AbstractBlackBoxTestCase {
public Code128BlackBox2TestCase() {
super("src/test/resources/blackbox/code128-2", new MultiFormatReader(), BarcodeFormat.CODE_128);
addTest(36, 39, 0.0f);
addTest(36, 39, 180.0f);
}
}

View File

@@ -1,34 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* @author Sean Owen
*/
public final class Code128BlackBox3TestCase extends AbstractBlackBoxTestCase {
public Code128BlackBox3TestCase() {
super("src/test/resources/blackbox/code128-3", new MultiFormatReader(), BarcodeFormat.CODE_128);
addTest(2, 2, 0.0f);
addTest(2, 2, 180.0f);
}
}

View File

@@ -1,34 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* @author Sean Owen
*/
public final class Code39BlackBox1TestCase extends AbstractBlackBoxTestCase {
public Code39BlackBox1TestCase() {
super("src/test/resources/blackbox/code39-1", new MultiFormatReader(), BarcodeFormat.CODE_39);
addTest(4, 4, 0.0f);
addTest(4, 4, 180.0f);
}
}

View File

@@ -1,34 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* @author dswitkin@google.com (Daniel Switkin)
*/
public final class Code39BlackBox3TestCase extends AbstractBlackBoxTestCase {
public Code39BlackBox3TestCase() {
super("src/test/resources/blackbox/code39-3", new MultiFormatReader(), BarcodeFormat.CODE_39);
addTest(17, 17, 0.0f);
addTest(17, 17, 180.0f);
}
}

View File

@@ -1,33 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* @author Sean Owen
*/
public final class Code39ExtendedBlackBox2TestCase extends AbstractBlackBoxTestCase {
public Code39ExtendedBlackBox2TestCase() {
super("src/test/resources/blackbox/code39-2", new Code39Reader(false, true), BarcodeFormat.CODE_39);
addTest(2, 2, 0.0f);
addTest(2, 2, 180.0f);
}
}

View File

@@ -1,57 +0,0 @@
/*
* Copyright 2017 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.oned;
import org.junit.Assert;
import org.junit.Test;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.common.BitArray;
import com.google.zxing.ChecksumException;
import com.google.zxing.FormatException;
import com.google.zxing.NotFoundException;
import com.google.zxing.RXingResult;
/**
* @author Michael Jahn
*/
public final class Code39ExtendedModeTestCase extends Assert {
@SuppressWarnings("checkstyle:lineLength")
@Test
public void testDecodeExtendedMode() throws FormatException, ChecksumException, NotFoundException {
doTest("\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f",
"000001001011011010101001001001011001010101101001001001010110101001011010010010010101011010010110100100100101011011010010101001001001010101011001011010010010010101101011001010100100100101010110110010101001001001010101010011011010010010010101101010011010100100100101010110100110101001001001010101011001101010010010010101101010100110100100100101010110101001101001001001010110110101001010010010010101010110100110100100100101011010110100101001001001010101101101001010010010010101010101100110100100100101011010101100101001001001010101101011001010010010010101010110110010100100100101011001010101101001001001010100110101011010010010010101100110101010100100100101010010110101101001001001010110010110101010010010010101001101101010101001001001011010100101101010010010010101101001011010100100100101101101001010101001001001010101100101101010010010010110101100101010010110110100000");
doTest(" !\"#$%&'()*+,-./0123456789:;<=>?",
"00000100101101101010011010110101001001010010110101001011010010010100101011010010110100100101001011011010010101001001010010101011001011010010010100101101011001010100100101001010110110010101001001010010101010011011010010010100101101010011010100100101001010110100110101001001010010101011001101010010010100101101010100110100100101001010110101001101001010110110110010101101010010010100101101011010010101001101101011010010101101011001010110110110010101010100110101101101001101010101100110101010100101101101101001011010101100101101010010010100101001101101010101001001001010110110010101010010010010101010011011010100100100101101010011010101001001001010110100110101010010010010101011001101010010110110100000");
doTest("@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_",
"000010010110110101010010010010100110101011011010100101101011010010110110110100101010101100101101101011001010101101100101010101001101101101010011010101101001101010101100110101101010100110101101010011011011010100101010110100110110101101001010110110100101010101100110110101011001010110101100101010110110010110010101011010011010101101100110101010100101101011011001011010101001101101010101001001001011010101001101010010010010101101010011010100100100101101101010010101001001001010101101001101010010010010110101101001010010110110100000");
doTest("`abcdefghijklmnopqrstuvwxyz{|}~",
"000001001011011010101001001001011001101010101001010010010110101001011010010100100101011010010110100101001001011011010010101001010010010101011001011010010100100101101011001010100101001001010110110010101001010010010101010011011010010100100101101010011010100101001001010110100110101001010010010101011001101010010100100101101010100110100101001001010110101001101001010010010110110101001010010100100101010110100110100101001001011010110100101001010010010101101101001010010100100101010101100110100101001001011010101100101001010010010101101011001010010100100101010110110010100101001001011001010101101001010010010100110101011010010100100101100110101010100101001001010010110101101001010010010110010110101010010100100101001101101010101001001001010110110100101010010010010101010110011010100100100101101010110010101001001001010110101100101010010010010101011011001010010110110100000");
}
private static void doTest(String expectedRXingResult, String encodedRXingResult)
throws FormatException, ChecksumException, NotFoundException {
Code39Reader sut = new Code39Reader(false, true);
BitMatrix matrix = BitMatrix.parse(encodedRXingResult, "1", "0");
BitArray row = new BitArray(matrix.getWidth());
matrix.getRow(0, row);
RXingResult result = sut.decodeRow(0, row, null);
assertEquals(expectedRXingResult, result.getText());
}
}

View File

@@ -1,34 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* @author Sean Owen
*/
public final class Code93BlackBox1TestCase extends AbstractBlackBoxTestCase {
public Code93BlackBox1TestCase() {
super("src/test/resources/blackbox/code93-1", new MultiFormatReader(), BarcodeFormat.CODE_93);
addTest(3, 3, 0.0f);
addTest(3, 3, 180.0f);
}
}

View File

@@ -1,34 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* @author Sean Owen
*/
public final class EAN13BlackBox1TestCase extends AbstractBlackBoxTestCase {
public EAN13BlackBox1TestCase() {
super("src/test/resources/blackbox/ean13-1", new MultiFormatReader(), BarcodeFormat.EAN_13);
addTest(30, 32, 0.0f);
addTest(27, 32, 180.0f);
}
}

View File

@@ -1,36 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* This is a set of mobile image taken at 480x360 with difficult lighting.
*
* @author dswitkin@google.com (Daniel Switkin)
*/
public final class EAN13BlackBox2TestCase extends AbstractBlackBoxTestCase {
public EAN13BlackBox2TestCase() {
super("src/test/resources/blackbox/ean13-2", new MultiFormatReader(), BarcodeFormat.EAN_13);
addTest(12, 17, 0, 1, 0.0f);
addTest(11, 17, 0, 1, 180.0f);
}
}

View File

@@ -1,34 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* @author dswitkin@google.com (Daniel Switkin)
*/
public final class EAN13BlackBox3TestCase extends AbstractBlackBoxTestCase {
public EAN13BlackBox3TestCase() {
super("src/test/resources/blackbox/ean13-3", new MultiFormatReader(), BarcodeFormat.EAN_13);
addTest(53, 55, 0.0f);
addTest(55, 55, 180.0f);
}
}

View File

@@ -1,35 +0,0 @@
/*
* Copyright 2009 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* A very difficult set of images taken with extreme shadows and highlights.
* @author dswitkin@google.com (Daniel Switkin)
*/
public final class EAN13BlackBox4TestCase extends AbstractBlackBoxTestCase {
public EAN13BlackBox4TestCase() {
super("src/test/resources/blackbox/ean13-4", new MultiFormatReader(), BarcodeFormat.EAN_13);
addTest(6, 13, 1, 1, 0.0f);
addTest(7, 13, 1, 1, 180.0f);
}
}

View File

@@ -1,35 +0,0 @@
/*
* Copyright 2011 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* A set of blurry images taken with a fixed-focus device.
* @author dswitkin@google.com (Daniel Switkin)
*/
public final class EAN13BlackBox5BlurryTestCase extends AbstractBlackBoxTestCase {
public EAN13BlackBox5BlurryTestCase() {
super("src/test/resources/blackbox/ean13-5", new MultiFormatReader(), BarcodeFormat.EAN_13);
addTest(0, 0, 0.0f);
addTest(0, 0, 180.0f);
}
}

View File

@@ -1,34 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* @author Sean Owen
*/
public final class EAN8BlackBox1TestCase extends AbstractBlackBoxTestCase {
public EAN8BlackBox1TestCase() {
super("src/test/resources/blackbox/ean8-1", new MultiFormatReader(), BarcodeFormat.EAN_8);
addTest(8, 8, 0.0f);
addTest(8, 8, 180.0f);
}
}

View File

@@ -1,34 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* @author kevin.osullivan@sita.aero
*/
public final class ITFBlackBox1TestCase extends AbstractBlackBoxTestCase {
public ITFBlackBox1TestCase() {
super("src/test/resources/blackbox/itf-1", new MultiFormatReader(), BarcodeFormat.ITF);
addTest(14, 14, 0.0f);
addTest(14, 14, 180.0f);
}
}

View File

@@ -1,34 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* @author dswitkin@google.com (Daniel Switkin)
*/
public final class ITFBlackBox2TestCase extends AbstractBlackBoxTestCase {
public ITFBlackBox2TestCase() {
super("src/test/resources/blackbox/itf-2", new MultiFormatReader(), BarcodeFormat.ITF);
addTest(13, 13, 0.0f);
addTest(13, 13, 180.0f);
}
}

View File

@@ -1,34 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* @author Sean Owen
*/
public final class UPCABlackBox1TestCase extends AbstractBlackBoxTestCase {
public UPCABlackBox1TestCase() {
super("src/test/resources/blackbox/upca-1", new MultiFormatReader(), BarcodeFormat.UPC_A);
addTest(14, 18, 0, 1, 0.0f);
addTest(16, 18, 0, 1, 180.0f);
}
}

View File

@@ -1,34 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* @author dswitkin@google.com (Daniel Switkin)
*/
public final class UPCABlackBox2TestCase extends AbstractBlackBoxTestCase {
public UPCABlackBox2TestCase() {
super("src/test/resources/blackbox/upca-2", new MultiFormatReader(), BarcodeFormat.UPC_A);
addTest(28, 36, 0, 2, 0.0f);
addTest(29, 36, 0, 2, 180.0f);
}
}

View File

@@ -1,34 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* @author dswitkin@google.com (Daniel Switkin)
*/
public final class UPCABlackBox3ReflectiveTestCase extends AbstractBlackBoxTestCase {
public UPCABlackBox3ReflectiveTestCase() {
super("src/test/resources/blackbox/upca-3", new MultiFormatReader(), BarcodeFormat.UPC_A);
addTest(7, 9, 0, 2, 0.0f);
addTest(8, 9, 0, 2, 180.0f);
}
}

View File

@@ -1,34 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* @author dswitkin@google.com (Daniel Switkin)
*/
public final class UPCABlackBox4TestCase extends AbstractBlackBoxTestCase {
public UPCABlackBox4TestCase() {
super("src/test/resources/blackbox/upca-4", new MultiFormatReader(), BarcodeFormat.UPC_A);
addTest(9, 11, 0, 1, 0.0f);
addTest(9, 11, 0, 1, 180.0f);
}
}

View File

@@ -1,34 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* @author dswitkin@google.com (Daniel Switkin)
*/
public final class UPCABlackBox5TestCase extends AbstractBlackBoxTestCase {
public UPCABlackBox5TestCase() {
super("src/test/resources/blackbox/upca-5", new MultiFormatReader(), BarcodeFormat.UPC_A);
addTest(20, 23, 0, 0, 0.0f);
addTest(22, 23, 0, 0, 180.0f);
}
}

View File

@@ -1,35 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* A set of blurry images taken with a fixed-focus device.
* @author dswitkin@google.com (Daniel Switkin)
*/
public final class UPCABlackBox6BlurryTestCase extends AbstractBlackBoxTestCase {
public UPCABlackBox6BlurryTestCase() {
super("src/test/resources/blackbox/upca-6", new MultiFormatReader(), BarcodeFormat.UPC_A);
addTest(0, 0, 0.0f);
addTest(0, 0, 180.0f);
}
}

View File

@@ -1,33 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* @author Sean Owen
*/
public final class UPCEANExtensionBlackBox1TestCase extends AbstractBlackBoxTestCase {
public UPCEANExtensionBlackBox1TestCase() {
super("src/test/resources/blackbox/upcean-extension-1", new MultiFormatReader(), BarcodeFormat.EAN_13);
addTest(2, 2, 0.0f);
}
}

View File

@@ -1,34 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* @author Sean Owen
*/
public final class UPCEBlackBox1TestCase extends AbstractBlackBoxTestCase {
public UPCEBlackBox1TestCase() {
super("src/test/resources/blackbox/upce-1", new MultiFormatReader(), BarcodeFormat.UPC_E);
addTest(3, 3, 0.0f);
addTest(3, 3, 180.0f);
}
}

View File

@@ -1,34 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* @author dswitkin@google.com (Daniel Switkin)
*/
public final class UPCEBlackBox2TestCase extends AbstractBlackBoxTestCase {
public UPCEBlackBox2TestCase() {
super("src/test/resources/blackbox/upce-2", new MultiFormatReader(), BarcodeFormat.UPC_E);
addTest(31, 35, 0, 1, 0.0f);
addTest(31, 35, 1, 1, 180.0f);
}
}

View File

@@ -1,34 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* @author dswitkin@google.com (Daniel Switkin)
*/
public final class UPCEBlackBox3ReflectiveTestCase extends AbstractBlackBoxTestCase {
public UPCEBlackBox3ReflectiveTestCase() {
super("src/test/resources/blackbox/upce-3", new MultiFormatReader(), BarcodeFormat.UPC_E);
addTest(6, 8, 0.0f);
addTest(6, 8, 180.0f);
}
}

Binary file not shown.

View File

@@ -1,34 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.oned.rss;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* @author Sean Owen
*/
public final class RSS14BlackBox1TestCase extends AbstractBlackBoxTestCase {
public RSS14BlackBox1TestCase() {
super("src/test/resources/blackbox/rss14-1", new MultiFormatReader(), BarcodeFormat.RSS_14);
addTest(6, 6, 0.0f);
addTest(6, 6, 180.0f);
}
}

View File

@@ -1,34 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.oned.rss;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* @author Sean Owen
*/
public final class RSS14BlackBox2TestCase extends AbstractBlackBoxTestCase {
public RSS14BlackBox2TestCase() {
super("src/test/resources/blackbox/rss14-2", new MultiFormatReader(), BarcodeFormat.RSS_14);
addTest(4, 8, 1, 1, 0.0f);
addTest(3, 8, 0, 1, 180.0f);
}
}

Binary file not shown.

View File

@@ -1,43 +0,0 @@
/*
* Copyright (C) 2010 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* These authors would like to acknowledge the Spanish Ministry of Industry,
* Tourism and Trade, for the support in the project TSI020301-2008-2
* "PIRAmIDE: Personalizable Interactions with Resources on AmI-enabled
* Mobile Dynamic Environments", led by Treelogic
* ( http://www.treelogic.com/ ):
*
* http://www.piramidepse.com/
*/
package com.google.zxing.oned.rss.expanded;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* A test of {@link RSSExpandedReader} against a fixed test set of images.
*/
public final class RSSExpandedBlackBox1TestCase extends AbstractBlackBoxTestCase {
public RSSExpandedBlackBox1TestCase() {
super("src/test/resources/blackbox/rssexpanded-1", new MultiFormatReader(), BarcodeFormat.RSS_EXPANDED);
addTest(32, 32, 0.0f);
addTest(32, 32, 180.0f);
}
}

View File

@@ -1,43 +0,0 @@
/*
* Copyright (C) 2010 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* These authors would like to acknowledge the Spanish Ministry of Industry,
* Tourism and Trade, for the support in the project TSI020301-2008-2
* "PIRAmIDE: Personalizable Interactions with Resources on AmI-enabled
* Mobile Dynamic Environments", led by Treelogic
* ( http://www.treelogic.com/ ):
*
* http://www.piramidepse.com/
*/
package com.google.zxing.oned.rss.expanded;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* A test of {@link RSSExpandedReader} against a fixed test set of images.
*/
public final class RSSExpandedBlackBox2TestCase extends AbstractBlackBoxTestCase {
public RSSExpandedBlackBox2TestCase() {
super("src/test/resources/blackbox/rssexpanded-2", new MultiFormatReader(), BarcodeFormat.RSS_EXPANDED);
addTest(21, 23, 0.0f);
addTest(21, 23, 180.0f);
}
}

View File

@@ -1,44 +0,0 @@
/*
* Copyright (C) 2010 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* These authors would like to acknowledge the Spanish Ministry of Industry,
* Tourism and Trade, for the support in the project TSI020301-2008-2
* "PIRAmIDE: Personalizable Interactions with Resources on AmI-enabled
* Mobile Dynamic Environments", led by Treelogic
* ( http://www.treelogic.com/ ):
*
* http://www.piramidepse.com/
*/
package com.google.zxing.oned.rss.expanded;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* A test of {@link RSSExpandedReader} against a fixed test set of images.
*/
public final class RSSExpandedBlackBox3TestCase extends AbstractBlackBoxTestCase {
public RSSExpandedBlackBox3TestCase() {
super("src/test/resources/blackbox/rssexpanded-3", new MultiFormatReader(), BarcodeFormat.RSS_EXPANDED);
addTest(117, 117, 0.0f);
addTest(117, 117, 180.0f);
}
}

View File

@@ -1,46 +0,0 @@
/*
* Copyright (C) 2012 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* These authors would like to acknowledge the Spanish Ministry of Industry,
* Tourism and Trade, for the support in the project TSI020301-2008-2
* "PIRAmIDE: Personalizable Interactions with Resources on AmI-enabled
* Mobile Dynamic Environments", led by Treelogic
* ( http://www.treelogic.com/ ):
*
* http://www.piramidepse.com/
*/
package com.google.zxing.oned.rss.expanded;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* A test of {@link RSSExpandedReader} against a fixed test set of images including
* stacked RSS barcodes.
*/
public final class RSSExpandedStackedBlackBox1TestCase extends AbstractBlackBoxTestCase {
public RSSExpandedStackedBlackBox1TestCase() {
super("src/test/resources/blackbox/rssexpandedstacked-1", new MultiFormatReader(), BarcodeFormat.RSS_EXPANDED);
addTest(59, 64, 0.0f);
addTest(59, 64, 180.0f);
}
}

View File

@@ -1,46 +0,0 @@
/*
* Copyright (C) 2012 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* These authors would like to acknowledge the Spanish Ministry of Industry,
* Tourism and Trade, for the support in the project TSI020301-2008-2
* "PIRAmIDE: Personalizable Interactions with Resources on AmI-enabled
* Mobile Dynamic Environments", led by Treelogic
* ( http://www.treelogic.com/ ):
*
* http://www.piramidepse.com/
*/
package com.google.zxing.oned.rss.expanded;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* A test of {@link RSSExpandedReader} against a fixed test set of images including
* stacked RSS barcodes.
*/
public final class RSSExpandedStackedBlackBox2TestCase extends AbstractBlackBoxTestCase {
public RSSExpandedStackedBlackBox2TestCase() {
super("src/test/resources/blackbox/rssexpandedstacked-2", new MultiFormatReader(), BarcodeFormat.RSS_EXPANDED);
addTest(2, 7, 0.0f);
addTest(2, 7, 180.0f);
}
}

Binary file not shown.

View File

@@ -1,38 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.pdf417;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* This test consists of perfect, computer-generated images. We should have 100% passing.
*
* @author SITA Lab (kevin.osullivan@sita.aero)
*/
public final class PDF417BlackBox1TestCase extends AbstractBlackBoxTestCase {
public PDF417BlackBox1TestCase() {
super("src/test/resources/blackbox/pdf417-1", new MultiFormatReader(), BarcodeFormat.PDF_417);
addTest(10, 10, 0.0f);
addTest(10, 10, 90.0f);
addTest(10, 10, 180.0f);
addTest(10, 10, 270.0f);
}
}

View File

@@ -1,36 +0,0 @@
/*
* Copyright 2009 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.pdf417;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* This test contains 480x240 images captured from an Android device at preview resolution.
*
* @author dswitkin@google.com (Daniel Switkin)
*/
public final class PDF417BlackBox2TestCase extends AbstractBlackBoxTestCase {
public PDF417BlackBox2TestCase() {
super("src/test/resources/blackbox/pdf417-2", new MultiFormatReader(), BarcodeFormat.PDF_417);
addTest(25, 25, 0, 0, 0.0f);
addTest(25, 25, 0, 0, 180.0f);
}
}

View File

@@ -1,34 +0,0 @@
/*
* Copyright 2009 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.pdf417;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* Tests {@link PDF417Reader} against more sample images.
*/
public final class PDF417BlackBox3TestCase extends AbstractBlackBoxTestCase {
public PDF417BlackBox3TestCase() {
super("src/test/resources/blackbox/pdf417-3", new MultiFormatReader(), BarcodeFormat.PDF_417);
addTest(19, 19, 0, 0, 0.0f);
addTest(19, 19, 0, 0, 180.0f);
}
}

View File

@@ -1,189 +0,0 @@
/*
* Copyright 2013 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.pdf417;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.BinaryBitmap;
import com.google.zxing.BufferedImageLuminanceSource;
import com.google.zxing.DecodeHintType;
import com.google.zxing.LuminanceSource;
import com.google.zxing.ReaderException;
import com.google.zxing.RXingResult;
import com.google.zxing.RXingResultMetadataType;
import com.google.zxing.common.AbstractBlackBoxTestCase;
import com.google.zxing.common.HybridBinarizer;
import com.google.zxing.common.TestRXingResult;
import com.google.zxing.multi.MultipleBarcodeReader;
import org.junit.Test;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.logging.Logger;
/**
* This class tests Macro PDF417 barcode specific functionality. It ensures that information, which is split into
* several barcodes can be properly combined again to yield the original data content.
*
* @author Guenther Grau
*/
public final class PDF417BlackBox4TestCase extends AbstractBlackBoxTestCase {
private static final Logger log = Logger.getLogger(AbstractBlackBoxTestCase.class.getSimpleName());
private final MultipleBarcodeReader barcodeReader = new PDF417Reader();
private final List<TestRXingResult> testRXingResults = new ArrayList<>();
public PDF417BlackBox4TestCase() {
super("src/test/resources/blackbox/pdf417-4", null, BarcodeFormat.PDF_417);
testRXingResults.add(new TestRXingResult(3, 3, 0, 0, 0.0f));
}
@Test
@Override
public void testBlackBox() throws IOException {
assertFalse(testRXingResults.isEmpty());
Map<String,List<Path>> imageFiles = getImageFileLists();
int testCount = testRXingResults.size();
int[] passedCounts = new int[testCount];
int[] tryHarderCounts = new int[testCount];
Path testBase = getTestBase();
for (Entry<String,List<Path>> testImageGroup : imageFiles.entrySet()) {
log.fine(String.format("Starting Image Group %s", testImageGroup.getKey()));
String fileBaseName = testImageGroup.getKey();
String expectedText;
Path expectedTextFile = testBase.resolve(fileBaseName + ".txt");
if (Files.exists(expectedTextFile)) {
expectedText = readFileAsString(expectedTextFile, StandardCharsets.UTF_8);
} else {
expectedTextFile = testBase.resolve(fileBaseName + ".bin");
assertTrue(Files.exists(expectedTextFile));
expectedText = readFileAsString(expectedTextFile, StandardCharsets.ISO_8859_1);
}
for (int x = 0; x < testCount; x++) {
List<RXingResult> results = new ArrayList<>();
for (Path imageFile : testImageGroup.getValue()) {
BufferedImage image = ImageIO.read(imageFile.toFile());
float rotation = testRXingResults.get(x).getRotation();
BufferedImage rotatedImage = rotateImage(image, rotation);
LuminanceSource source = new BufferedImageLuminanceSource(rotatedImage);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
try {
results.addAll(Arrays.asList(decode(bitmap, false)));
} catch (ReaderException ignored) {
// ignore
}
}
results.sort(Comparator.comparingInt((RXingResult r) -> getMeta(r).getSegmentIndex()));
StringBuilder resultText = new StringBuilder();
String fileId = null;
for (RXingResult result : results) {
PDF417RXingResultMetadata resultMetadata = getMeta(result);
assertNotNull("resultMetadata", resultMetadata);
if (fileId == null) {
fileId = resultMetadata.getFileId();
}
assertEquals("FileId", fileId, resultMetadata.getFileId());
resultText.append(result.getText());
}
assertEquals("ExpectedText", expectedText, resultText.toString());
passedCounts[x]++;
tryHarderCounts[x]++;
}
}
// Print the results of all tests first
int totalFound = 0;
int totalMustPass = 0;
int numberOfTests = imageFiles.keySet().size();
for (int x = 0; x < testRXingResults.size(); x++) {
TestRXingResult testRXingResult = testRXingResults.get(x);
log.info(String.format("Rotation %d degrees:", (int) testRXingResult.getRotation()));
log.info(String.format(" %d of %d images passed (%d required)", passedCounts[x], numberOfTests,
testRXingResult.getMustPassCount()));
log.info(String.format(" %d of %d images passed with try harder (%d required)", tryHarderCounts[x],
numberOfTests, testRXingResult.getTryHarderCount()));
totalFound += passedCounts[x] + tryHarderCounts[x];
totalMustPass += testRXingResult.getMustPassCount() + testRXingResult.getTryHarderCount();
}
int totalTests = numberOfTests * testCount * 2;
log.info(String.format("Decoded %d images out of %d (%d%%, %d required)", totalFound, totalTests, totalFound *
100 /
totalTests, totalMustPass));
if (totalFound > totalMustPass) {
log.warning(String.format("+++ Test too lax by %d images", totalFound - totalMustPass));
} else if (totalFound < totalMustPass) {
log.warning(String.format("--- Test failed by %d images", totalMustPass - totalFound));
}
// Then run through again and assert if any failed
for (int x = 0; x < testCount; x++) {
TestRXingResult testRXingResult = testRXingResults.get(x);
String label = "Rotation " + testRXingResult.getRotation() + " degrees: Too many images failed";
assertTrue(label, passedCounts[x] >= testRXingResult.getMustPassCount());
assertTrue("Try harder, " + label, tryHarderCounts[x] >= testRXingResult.getTryHarderCount());
}
}
private static PDF417RXingResultMetadata getMeta(RXingResult result) {
return result.getRXingResultMetadata() == null ? null : (PDF417RXingResultMetadata) result.getRXingResultMetadata().get(
RXingResultMetadataType.PDF417_EXTRA_METADATA);
}
private RXingResult[] decode(BinaryBitmap source, boolean tryHarder) throws ReaderException {
Map<DecodeHintType,Object> hints = new EnumMap<>(DecodeHintType.class);
if (tryHarder) {
hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
}
return barcodeReader.decodeMultiple(source, hints);
}
private Map<String,List<Path>> getImageFileLists() throws IOException {
Map<String,List<Path>> result = new HashMap<>();
for (Path file : getImageFiles()) {
String testImageFileName = file.getFileName().toString();
String fileBaseName = testImageFileName.substring(0, testImageFileName.indexOf('-'));
List<Path> files = result.computeIfAbsent(fileBaseName, k -> new ArrayList<>());
files.add(file);
}
return result;
}
}

Binary file not shown.

View File

@@ -1,36 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.qrcode;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* @author Sean Owen
*/
public final class QRCodeBlackBox1TestCase extends AbstractBlackBoxTestCase {
public QRCodeBlackBox1TestCase() {
super("src/test/resources/blackbox/qrcode-1", new MultiFormatReader(), BarcodeFormat.QR_CODE);
addTest(17, 17, 0.0f);
addTest(14, 14, 90.0f);
addTest(17, 17, 180.0f);
addTest(14, 14, 270.0f);
}
}

View File

@@ -1,36 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.qrcode;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* @author Sean Owen
*/
public final class QRCodeBlackBox2TestCase extends AbstractBlackBoxTestCase {
public QRCodeBlackBox2TestCase() {
super("src/test/resources/blackbox/qrcode-2", new MultiFormatReader(), BarcodeFormat.QR_CODE);
addTest(31, 31, 0.0f);
addTest(30, 30, 90.0f);
addTest(30, 30, 180.0f);
addTest(30, 30, 270.0f);
}
}

View File

@@ -1,36 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.qrcode;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* @author dswitkin@google.com (Daniel Switkin)
*/
public final class QRCodeBlackBox3TestCase extends AbstractBlackBoxTestCase {
public QRCodeBlackBox3TestCase() {
super("src/test/resources/blackbox/qrcode-3", new MultiFormatReader(), BarcodeFormat.QR_CODE);
addTest(38, 38, 0.0f);
addTest(39, 39, 90.0f);
addTest(36, 36, 180.0f);
addTest(39, 39, 270.0f);
}
}

View File

@@ -1,38 +0,0 @@
/*
* Copyright 2008 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.qrcode;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* Tests of various QR Codes from t-shirts, which are notoriously not flat.
*
* @author dswitkin@google.com (Daniel Switkin)
*/
public final class QRCodeBlackBox4TestCase extends AbstractBlackBoxTestCase {
public QRCodeBlackBox4TestCase() {
super("src/test/resources/blackbox/qrcode-4", new MultiFormatReader(), BarcodeFormat.QR_CODE);
addTest(36, 36, 0.0f);
addTest(35, 35, 90.0f);
addTest(35, 35, 180.0f);
addTest(35, 35, 270.0f);
}
}

View File

@@ -1,40 +0,0 @@
/*
* Copyright 2009 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.qrcode;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* Some very difficult exposure conditions including self-shadowing, which happens a lot when
* pointing down at a barcode (i.e. the phone's shadow falls across part of the image).
* The global histogram gets about 5/15, where the local one gets 15/15.
*
* @author dswitkin@google.com (Daniel Switkin)
*/
public final class QRCodeBlackBox5TestCase extends AbstractBlackBoxTestCase {
public QRCodeBlackBox5TestCase() {
super("src/test/resources/blackbox/qrcode-5", new MultiFormatReader(), BarcodeFormat.QR_CODE);
addTest(19, 19, 0.0f);
addTest(19, 19, 90.0f);
addTest(19, 19, 180.0f);
addTest(19, 19, 270.0f);
}
}

View File

@@ -1,37 +0,0 @@
/*
* Copyright 2009 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.qrcode;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.common.AbstractBlackBoxTestCase;
/**
* These tests are supplied by Tim Gernat and test finder pattern detection at small size and under
* rotation, which was a weak spot.
*/
public final class QRCodeBlackBox6TestCase extends AbstractBlackBoxTestCase {
public QRCodeBlackBox6TestCase() {
super("src/test/resources/blackbox/qrcode-6", new MultiFormatReader(), BarcodeFormat.QR_CODE);
addTest(15, 15, 0.0f);
addTest(14, 14, 90.0f);
addTest(13, 13, 180.0f);
addTest(14, 14, 270.0f);
}
}