move all Result to RXingResult

This commit is contained in:
Henry Schimke
2022-08-20 12:12:30 -05:00
parent 9f72478dc8
commit 90ace738b7
149 changed files with 1658 additions and 1658 deletions

View File

@@ -18,11 +18,11 @@ package com.google.zxing.aztec.decoder;
import com.google.zxing.aztec.encoder.EncoderTest;
import com.google.zxing.FormatException;
import com.google.zxing.ResultPoint;
import com.google.zxing.aztec.AztecDetectorResult;
import com.google.zxing.RXingResultPoint;
import com.google.zxing.aztec.AztecDetectorRXingResult;
import com.google.zxing.common.BitArray;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.common.DecoderResult;
import com.google.zxing.common.DecoderRXingResult;
import org.junit.Test;
import org.junit.Assert;
@@ -31,7 +31,7 @@ import org.junit.Assert;
*/
public final class DecoderTest extends Assert {
private static final ResultPoint[] NO_POINTS = new ResultPoint[0];
private static final RXingResultPoint[] NO_POINTS = new RXingResultPoint[0];
@Test
public void testHighLevelDecode() throws FormatException {
@@ -64,7 +64,7 @@ public final class DecoderTest extends Assert {
}
@Test
public void testAztecResult() throws FormatException {
public void testAztecRXingResult() throws FormatException {
BitMatrix matrix = BitMatrix.parse(
"X X X X X X X X X X X X X X \n" +
"X X X X X X X X X X X X X X X \n" +
@@ -90,8 +90,8 @@ public final class DecoderTest extends Assert {
"X X X X X X X X X X X X X X \n" +
" X X X X X X X X X X X X X \n",
"X ", " ");
AztecDetectorResult r = new AztecDetectorResult(matrix, NO_POINTS, false, 30, 2);
DecoderResult result = new Decoder().decode(r);
AztecDetectorRXingResult r = new AztecDetectorRXingResult(matrix, NO_POINTS, false, 30, 2);
DecoderRXingResult result = new Decoder().decode(r);
assertEquals("88888TTTTTTTTTTTTTTTTTTTTTTTTTTTTTT", result.getText());
assertArrayEquals(
new byte[] {-11, 85, 85, 117, 107, 90, -42, -75, -83, 107,
@@ -102,7 +102,7 @@ public final class DecoderTest extends Assert {
}
@Test
public void testAztecResultECI() throws FormatException {
public void testAztecRXingResultECI() throws FormatException {
BitMatrix matrix = BitMatrix.parse(
" X X X X X X \n" +
" X X X X X X X X X X X X \n" +
@@ -124,8 +124,8 @@ public final class DecoderTest extends Assert {
" X X X X X X X X X X X \n" +
"X X X X X X X X \n",
"X ", " ");
AztecDetectorResult r = new AztecDetectorResult(matrix, NO_POINTS, false, 15, 1);
DecoderResult result = new Decoder().decode(r);
AztecDetectorRXingResult r = new AztecDetectorRXingResult(matrix, NO_POINTS, false, 15, 1);
DecoderRXingResult result = new Decoder().decode(r);
assertEquals("Français", result.getText());
}
@@ -160,7 +160,7 @@ public final class DecoderTest extends Assert {
+ "X X X X . . . X . . X X X . X X . . X . . . . X X X . \n"
+ "X X . X . X . . . X . X . . . . X X . X . . X X . . . \n",
"X ", ". ");
AztecDetectorResult r = new AztecDetectorResult(matrix, NO_POINTS, true, 16, 4);
AztecDetectorRXingResult r = new AztecDetectorRXingResult(matrix, NO_POINTS, true, 16, 4);
new Decoder().decode(r);
}
@@ -195,7 +195,7 @@ public final class DecoderTest extends Assert {
+ ". X X X X . . X . . X X X . X X . . X . . . . X X X . \n"
+ "X X . . . X X . . X . X . . . . X X . X . . X . X . X \n",
"X ", ". ");
AztecDetectorResult r = new AztecDetectorResult(matrix, NO_POINTS, true, 16, 4);
AztecDetectorRXingResult r = new AztecDetectorRXingResult(matrix, NO_POINTS, true, 16, 4);
new Decoder().decode(r);
}

View File

@@ -17,13 +17,13 @@
package com.google.zxing.aztec.detector;
import com.google.zxing.NotFoundException;
import com.google.zxing.aztec.AztecDetectorResult;
import com.google.zxing.aztec.AztecDetectorRXingResult;
import com.google.zxing.aztec.decoder.Decoder;
import com.google.zxing.aztec.detector.Detector.Point;
import com.google.zxing.aztec.encoder.AztecCode;
import com.google.zxing.aztec.encoder.Encoder;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.common.DecoderResult;
import com.google.zxing.common.DecoderRXingResult;
import org.junit.Assert;
import org.junit.Test;
@@ -78,11 +78,11 @@ public final class DetectorTest extends Assert {
copy.flip(orientationPoints.get(error2).getX(), orientationPoints.get(error2).getY());
}
// The detector doesn't seem to work when matrix bits are only 1x1. So magnify.
AztecDetectorResult r = new Detector(makeLarger(copy, 3)).detect(isMirror);
AztecDetectorRXingResult r = new Detector(makeLarger(copy, 3)).detect(isMirror);
assertNotNull(r);
assertEquals(r.getNbLayers(), layers);
assertEquals(r.isCompact(), compact);
DecoderResult res = new Decoder().decode(r);
DecoderRXingResult res = new Decoder().decode(r);
assertEquals(data, res.getText());
}
}

View File

@@ -19,13 +19,13 @@ package com.google.zxing.aztec.encoder;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.FormatException;
import com.google.zxing.ResultPoint;
import com.google.zxing.aztec.AztecDetectorResult;
import com.google.zxing.RXingResultPoint;
import com.google.zxing.aztec.AztecDetectorRXingResult;
import com.google.zxing.aztec.AztecWriter;
import com.google.zxing.aztec.decoder.Decoder;
import com.google.zxing.common.BitArray;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.common.DecoderResult;
import com.google.zxing.common.DecoderRXingResult;
import org.junit.Assert;
import org.junit.Test;
@@ -52,7 +52,7 @@ public final class EncoderTest extends Assert {
private static final Pattern DOTX = Pattern.compile("[^.X]");
private static final Pattern SPACES = Pattern.compile("\\s+");
private static final ResultPoint[] NO_POINTS = new ResultPoint[0];
private static final RXingResultPoint[] NO_POINTS = new RXingResultPoint[0];
// real life tests
@@ -492,9 +492,9 @@ public final class EncoderTest extends Assert {
assertEquals("Unexpected symbol format (compact)", compact, aztec.isCompact());
assertEquals("Unexpected nr. of layers", layers, aztec.getLayers());
BitMatrix matrix = aztec.getMatrix();
AztecDetectorResult r =
new AztecDetectorResult(matrix, NO_POINTS, aztec.isCompact(), aztec.getCodeWords(), aztec.getLayers());
DecoderResult res = new Decoder().decode(r);
AztecDetectorRXingResult r =
new AztecDetectorRXingResult(matrix, NO_POINTS, aztec.isCompact(), aztec.getCodeWords(), aztec.getLayers());
DecoderRXingResult res = new Decoder().decode(r);
assertEquals(data, res.getText());
// Check error correction by introducing a few minor errors
Random random = getPseudoRandom();
@@ -502,7 +502,7 @@ public final class EncoderTest extends Assert {
matrix.flip(random.nextInt(matrix.getWidth()), matrix.getHeight() - 2 + random.nextInt(2));
matrix.flip(random.nextInt(2), random.nextInt(matrix.getHeight()));
matrix.flip(matrix.getWidth() - 2 + random.nextInt(2), random.nextInt(matrix.getHeight()));
r = new AztecDetectorResult(matrix, NO_POINTS, aztec.isCompact(), aztec.getCodeWords(), aztec.getLayers());
r = new AztecDetectorRXingResult(matrix, NO_POINTS, aztec.isCompact(), aztec.getCodeWords(), aztec.getLayers());
res = new Decoder().decode(r);
assertEquals(data, res.getText());
}
@@ -526,9 +526,9 @@ public final class EncoderTest extends Assert {
assertEquals("Unexpected nr. of layers", layers, aztec.getLayers());
BitMatrix matrix2 = aztec.getMatrix();
assertEquals(matrix, matrix2);
AztecDetectorResult r =
new AztecDetectorResult(matrix, NO_POINTS, aztec.isCompact(), aztec.getCodeWords(), aztec.getLayers());
DecoderResult res = new Decoder().decode(r);
AztecDetectorRXingResult r =
new AztecDetectorRXingResult(matrix, NO_POINTS, aztec.isCompact(), aztec.getCodeWords(), aztec.getLayers());
DecoderRXingResult res = new Decoder().decode(r);
assertEquals(data, res.getText());
// Check error correction by introducing up to eccPercent/2 errors
int ecWords = aztec.getCodeWords() * eccPercent / 100 / 2;
@@ -543,7 +543,7 @@ public final class EncoderTest extends Assert {
: matrix.getHeight() - 1 - random.nextInt(aztec.getLayers() * 2);
matrix.flip(x, y);
}
r = new AztecDetectorResult(matrix, NO_POINTS, aztec.isCompact(), aztec.getCodeWords(), aztec.getLayers());
r = new AztecDetectorRXingResult(matrix, NO_POINTS, aztec.isCompact(), aztec.getCodeWords(), aztec.getLayers());
res = new Decoder().decode(r);
assertEquals(data, res.getText());
}