"Fossies" - the Fresh Open Source Software Archive  

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

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

DetectorTest.java  (zxing-zxing-3.4.1):DetectorTest.java  (zxing-zxing-3.5.0)
skipping to change at line 30 skipping to change at line 30
import com.google.zxing.aztec.AztecDetectorResult; import com.google.zxing.aztec.AztecDetectorResult;
import com.google.zxing.aztec.decoder.Decoder; import com.google.zxing.aztec.decoder.Decoder;
import com.google.zxing.aztec.detector.Detector.Point; import com.google.zxing.aztec.detector.Detector.Point;
import com.google.zxing.aztec.encoder.AztecCode; import com.google.zxing.aztec.encoder.AztecCode;
import com.google.zxing.aztec.encoder.Encoder; import com.google.zxing.aztec.encoder.Encoder;
import com.google.zxing.common.BitMatrix; import com.google.zxing.common.BitMatrix;
import com.google.zxing.common.DecoderResult; import com.google.zxing.common.DecoderResult;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import java.util.TreeSet; import java.util.TreeSet;
/** /**
* Tests for the Detector * Tests for the Detector
* *
skipping to change at line 65 skipping to change at line 64
} }
@Test @Test
public void testErrorInParameterLocatorNotCompact() throws Exception { public void testErrorInParameterLocatorNotCompact() throws Exception {
String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYabcdefghijklmnopqrstuvwxyz"; String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYabcdefghijklmnopqrstuvwxyz";
testErrorInParameterLocator(alphabet + alphabet + alphabet); testErrorInParameterLocator(alphabet + alphabet + alphabet);
} }
// Test that we can tolerate errors in the parameter locator bits // Test that we can tolerate errors in the parameter locator bits
private static void testErrorInParameterLocator(String data) throws Exception { private static void testErrorInParameterLocator(String data) throws Exception {
AztecCode aztec = Encoder.encode(data.getBytes(StandardCharsets.ISO_8859_1), 25, Encoder.DEFAULT_AZTEC_LAYERS); AztecCode aztec = Encoder.encode(data, 25, Encoder.DEFAULT_AZTEC_LAYERS);
Random random = new Random(aztec.getMatrix().hashCode()); // pseudo-random , but deterministic Random random = new Random(aztec.getMatrix().hashCode()); // pseudo-random , but deterministic
int layers = aztec.getLayers(); int layers = aztec.getLayers();
boolean compact = aztec.isCompact(); boolean compact = aztec.isCompact();
List<Point> orientationPoints = getOrientationPoints(aztec); List<Point> orientationPoints = getOrientationPoints(aztec);
for (boolean isMirror : new boolean[] { false, true }) { for (boolean isMirror : new boolean[] { false, true }) {
for (BitMatrix matrix : getRotations(aztec.getMatrix())) { for (BitMatrix matrix : getRotations(aztec.getMatrix())) {
// Systematically try every possible 1- and 2-bit error. // Systematically try every possible 1- and 2-bit error.
for (int error1 = 0; error1 < orientationPoints.size(); error1++) { for (int error1 = 0; error1 < orientationPoints.size(); error1++) {
for (int error2 = error1; error2 < orientationPoints.size(); error2++) { for (int error2 = error1; error2 < orientationPoints.size(); error2++) {
BitMatrix copy = isMirror ? transpose(matrix) : clone(matrix); BitMatrix copy = isMirror ? transpose(matrix) : clone(matrix);
 End of changes. 2 change blocks. 
2 lines changed or deleted 1 lines changed or added

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