mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Misc dead code cleanup, plugin updates
This commit is contained in:
parent
820d091073
commit
e7ed6aee2f
|
@ -93,20 +93,6 @@ final class CameraConfigurationManager {
|
||||||
Log.i(TAG, "Front camera overriden to: " + cwRotationFromNaturalToCamera);
|
Log.i(TAG, "Front camera overriden to: " + cwRotationFromNaturalToCamera);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
|
||||||
String overrideRotationString;
|
|
||||||
if (camera.getFacing() == CameraFacing.FRONT) {
|
|
||||||
overrideRotationString = prefs.getString(PreferencesActivity.KEY_FORCE_CAMERA_ORIENTATION_FRONT, null);
|
|
||||||
} else {
|
|
||||||
overrideRotationString = prefs.getString(PreferencesActivity.KEY_FORCE_CAMERA_ORIENTATION, null);
|
|
||||||
}
|
|
||||||
if (overrideRotationString != null && !"-".equals(overrideRotationString)) {
|
|
||||||
Log.i(TAG, "Overriding camera manually to " + overrideRotationString);
|
|
||||||
cwRotationFromNaturalToCamera = Integer.parseInt(overrideRotationString);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
cwRotationFromDisplayToCamera =
|
cwRotationFromDisplayToCamera =
|
||||||
(360 + cwRotationFromNaturalToCamera - cwRotationFromNaturalToDisplay) % 360;
|
(360 + cwRotationFromNaturalToCamera - cwRotationFromNaturalToDisplay) % 360;
|
||||||
Log.i(TAG, "Final display orientation: " + cwRotationFromDisplayToCamera);
|
Log.i(TAG, "Final display orientation: " + cwRotationFromDisplayToCamera);
|
||||||
|
|
|
@ -63,7 +63,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>biz.aQute.bnd</groupId>
|
<groupId>biz.aQute.bnd</groupId>
|
||||||
<artifactId>bnd-maven-plugin</artifactId>
|
<artifactId>bnd-maven-plugin</artifactId>
|
||||||
<version>5.1.2</version>
|
<version>5.2.0</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<goals>
|
<goals>
|
||||||
|
|
|
@ -26,6 +26,7 @@ import com.google.zxing.common.reedsolomon.ReedSolomonDecoder;
|
||||||
import com.google.zxing.common.reedsolomon.ReedSolomonException;
|
import com.google.zxing.common.reedsolomon.ReedSolomonException;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -160,7 +161,12 @@ public final class Decoder {
|
||||||
throw FormatException.getFormatInstance(); // FLG(7) is reserved and illegal
|
throw FormatException.getFormatInstance(); // FLG(7) is reserved and illegal
|
||||||
default:
|
default:
|
||||||
// flush bytes before changing character set
|
// flush bytes before changing character set
|
||||||
result.append(new String(decodedBytes.toByteArray(), encoding));
|
try {
|
||||||
|
result.append(decodedBytes.toString(encoding.name()));
|
||||||
|
} catch (UnsupportedEncodingException uee) {
|
||||||
|
// can't happen
|
||||||
|
throw new IllegalStateException(uee);
|
||||||
|
}
|
||||||
decodedBytes.reset();
|
decodedBytes.reset();
|
||||||
|
|
||||||
// ECI is decimal integer encoded as 1-6 codes in DIGIT mode
|
// ECI is decimal integer encoded as 1-6 codes in DIGIT mode
|
||||||
|
@ -200,7 +206,12 @@ public final class Decoder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result.append(new String(decodedBytes.toByteArray(), encoding));
|
try {
|
||||||
|
result.append(decodedBytes.toString(encoding.name()));
|
||||||
|
} catch (UnsupportedEncodingException uee) {
|
||||||
|
// can't happen
|
||||||
|
throw new IllegalStateException(uee);
|
||||||
|
}
|
||||||
return result.toString();
|
return result.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,12 +48,6 @@ final class State {
|
||||||
this.mode = mode;
|
this.mode = mode;
|
||||||
this.binaryShiftByteCount = binaryBytes;
|
this.binaryShiftByteCount = binaryBytes;
|
||||||
this.bitCount = bitCount;
|
this.bitCount = bitCount;
|
||||||
// Make sure we match the token
|
|
||||||
//int binaryShiftBitCount = (binaryShiftByteCount * 8) +
|
|
||||||
// (binaryShiftByteCount == 0 ? 0 :
|
|
||||||
// binaryShiftByteCount <= 31 ? 10 :
|
|
||||||
// binaryShiftByteCount <= 62 ? 20 : 21);
|
|
||||||
//assert this.bitCount == token.getTotalBitCount() + binaryShiftBitCount;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int getMode() {
|
int getMode() {
|
||||||
|
@ -83,8 +77,8 @@ final class State {
|
||||||
} else {
|
} else {
|
||||||
byte[] eciDigits = Integer.toString(eci).getBytes(StandardCharsets.ISO_8859_1);
|
byte[] eciDigits = Integer.toString(eci).getBytes(StandardCharsets.ISO_8859_1);
|
||||||
token = token.add(eciDigits.length, 3); // 1-6: number of ECI digits
|
token = token.add(eciDigits.length, 3); // 1-6: number of ECI digits
|
||||||
for (int ii = 0; ii < eciDigits.length; ii++) {
|
for (byte eciDigit : eciDigits) {
|
||||||
token = token.add(eciDigits[ii] - '0' + 2, 4);
|
token = token.add(eciDigit - '0' + 2, 4);
|
||||||
}
|
}
|
||||||
bitsAdded += eciDigits.length * 4;
|
bitsAdded += eciDigits.length * 4;
|
||||||
}
|
}
|
||||||
|
|
|
@ -307,10 +307,8 @@ public final class BitMatrix implements Cloneable {
|
||||||
for (int x = 0; x < width; x++) {
|
for (int x = 0; x < width; x++) {
|
||||||
int offset = y * rowSize + (x / 32);
|
int offset = y * rowSize + (x / 32);
|
||||||
if (((bits[offset] >>> (x & 0x1f)) & 1) != 0) {
|
if (((bits[offset] >>> (x & 0x1f)) & 1) != 0) {
|
||||||
int newY = newHeight - 1 - x;
|
int newOffset = (newHeight - 1 - x) * newRowSize + (y / 32);
|
||||||
int newX = y;
|
newBits[newOffset] |= 1 << (y & 0x1f);
|
||||||
int newOffset = newY * newRowSize + (newX / 32);
|
|
||||||
newBits[newOffset] |= 1 << (newX & 0x1f);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,20 +111,6 @@ public final class HighLevelEncoder {
|
||||||
private HighLevelEncoder() {
|
private HighLevelEncoder() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Converts the message to a byte array using the default encoding (cp437) as defined by the
|
|
||||||
* specification
|
|
||||||
*
|
|
||||||
* @param msg the message
|
|
||||||
* @return the byte array of the message
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
public static byte[] getBytesForMessage(String msg) {
|
|
||||||
return msg.getBytes(Charset.forName("cp437")); //See 4.4.3 and annex B of ISO/IEC 15438:2001(E)
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
private static char randomize253State(int codewordPosition) {
|
private static char randomize253State(int codewordPosition) {
|
||||||
int pseudoRandom = ((149 * codewordPosition) % 253) + 1;
|
int pseudoRandom = ((149 * codewordPosition) % 253) + 1;
|
||||||
int tempVariable = PAD + pseudoRandom;
|
int tempVariable = PAD + pseudoRandom;
|
||||||
|
|
|
@ -59,7 +59,7 @@ final class TextEncoder extends C40Encoder {
|
||||||
}
|
}
|
||||||
if (c == '`') {
|
if (c == '`') {
|
||||||
sb.append('\2'); //Shift 3 Set
|
sb.append('\2'); //Shift 3 Set
|
||||||
sb.append((char) (c - 96));
|
sb.append((char) 0); // '`' - 96 == 0
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
if (c <= 'Z') {
|
if (c <= 'Z') {
|
||||||
|
|
|
@ -139,11 +139,6 @@ public final class RSS14Reader extends AbstractRSSReader {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean checkChecksum(Pair leftPair, Pair rightPair) {
|
private static boolean checkChecksum(Pair leftPair, Pair rightPair) {
|
||||||
//int leftFPValue = leftPair.getFinderPattern().getValue();
|
|
||||||
//int rightFPValue = rightPair.getFinderPattern().getValue();
|
|
||||||
//if ((leftFPValue == 0 && rightFPValue == 8) ||
|
|
||||||
// (leftFPValue == 8 && rightFPValue == 0)) {
|
|
||||||
//}
|
|
||||||
int checkValue = (leftPair.getChecksumPortion() + 16 * rightPair.getChecksumPortion()) % 79;
|
int checkValue = (leftPair.getChecksumPortion() + 16 * rightPair.getChecksumPortion()) % 79;
|
||||||
int targetCheckValue =
|
int targetCheckValue =
|
||||||
9 * leftPair.getFinderPattern().getValue() + rightPair.getFinderPattern().getValue();
|
9 * leftPair.getFinderPattern().getValue() + rightPair.getFinderPattern().getValue();
|
||||||
|
|
|
@ -35,8 +35,8 @@ final class BlockParsedResult {
|
||||||
private final DecodedInformation decodedInformation;
|
private final DecodedInformation decodedInformation;
|
||||||
private final boolean finished;
|
private final boolean finished;
|
||||||
|
|
||||||
BlockParsedResult(boolean finished) {
|
BlockParsedResult() {
|
||||||
this(null, finished);
|
this(null, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockParsedResult(DecodedInformation information, boolean finished) {
|
BlockParsedResult(DecodedInformation information, boolean finished) {
|
||||||
|
|
|
@ -185,7 +185,7 @@ final class GeneralAppIdDecoder {
|
||||||
current.setAlpha();
|
current.setAlpha();
|
||||||
current.incrementPosition(4);
|
current.incrementPosition(4);
|
||||||
}
|
}
|
||||||
return new BlockParsedResult(false);
|
return new BlockParsedResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
private BlockParsedResult parseIsoIec646Block() throws FormatException {
|
private BlockParsedResult parseIsoIec646Block() throws FormatException {
|
||||||
|
@ -212,7 +212,7 @@ final class GeneralAppIdDecoder {
|
||||||
|
|
||||||
current.setAlpha();
|
current.setAlpha();
|
||||||
}
|
}
|
||||||
return new BlockParsedResult(false);
|
return new BlockParsedResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
private BlockParsedResult parseAlphaBlock() {
|
private BlockParsedResult parseAlphaBlock() {
|
||||||
|
@ -240,7 +240,7 @@ final class GeneralAppIdDecoder {
|
||||||
|
|
||||||
current.setIsoIec646();
|
current.setIsoIec646();
|
||||||
}
|
}
|
||||||
return new BlockParsedResult(false);
|
return new BlockParsedResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isStillIsoIec646(int pos) {
|
private boolean isStillIsoIec646(int pos) {
|
||||||
|
|
|
@ -22,6 +22,7 @@ import com.google.zxing.common.DecoderResult;
|
||||||
import com.google.zxing.pdf417.PDF417ResultMetadata;
|
import com.google.zxing.pdf417.PDF417ResultMetadata;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
@ -608,7 +609,12 @@ final class DecodedBitStreamParser {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
result.append(new String(decodedBytes.toByteArray(), encoding));
|
try {
|
||||||
|
result.append(decodedBytes.toString(encoding.name()));
|
||||||
|
} catch (UnsupportedEncodingException uee) {
|
||||||
|
// can't happen
|
||||||
|
throw new IllegalStateException(uee);
|
||||||
|
}
|
||||||
return codeIndex;
|
return codeIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,14 +64,6 @@ final class DetectionResultRowIndicatorColumn extends DetectionResultColumn {
|
||||||
}
|
}
|
||||||
Codeword codeword = codewords[codewordsRow];
|
Codeword codeword = codewords[codewordsRow];
|
||||||
|
|
||||||
// float expectedRowNumber = (codewordsRow - firstRow) / averageRowHeight;
|
|
||||||
// if (Math.abs(codeword.getRowNumber() - expectedRowNumber) > 2) {
|
|
||||||
// SimpleLog.log(LEVEL.WARNING,
|
|
||||||
// "Removing codeword, rowNumberSkew too high, codeword[" + codewordsRow + "]: Expected Row: " +
|
|
||||||
// expectedRowNumber + ", RealRow: " + codeword.getRowNumber() + ", value: " + codeword.getValue());
|
|
||||||
// codewords[codewordsRow] = null;
|
|
||||||
// }
|
|
||||||
|
|
||||||
int rowDifference = codeword.getRowNumber() - barcodeRow;
|
int rowDifference = codeword.getRowNumber() - barcodeRow;
|
||||||
|
|
||||||
// TODO improve handling with case where first row indicator doesn't start with 0
|
// TODO improve handling with case where first row indicator doesn't start with 0
|
||||||
|
|
|
@ -200,34 +200,6 @@ final class ModulusPoly {
|
||||||
return new ModulusPoly(field, product);
|
return new ModulusPoly(field, product);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
ModulusPoly[] divide(ModulusPoly other) {
|
|
||||||
if (!field.equals(other.field)) {
|
|
||||||
throw new IllegalArgumentException("ModulusPolys do not have same ModulusGF field");
|
|
||||||
}
|
|
||||||
if (other.isZero()) {
|
|
||||||
throw new IllegalArgumentException("Divide by 0");
|
|
||||||
}
|
|
||||||
|
|
||||||
ModulusPoly quotient = field.getZero();
|
|
||||||
ModulusPoly remainder = this;
|
|
||||||
|
|
||||||
int denominatorLeadingTerm = other.getCoefficient(other.getDegree());
|
|
||||||
int inverseDenominatorLeadingTerm = field.inverse(denominatorLeadingTerm);
|
|
||||||
|
|
||||||
while (remainder.getDegree() >= other.getDegree() && !remainder.isZero()) {
|
|
||||||
int degreeDifference = remainder.getDegree() - other.getDegree();
|
|
||||||
int scale = field.multiply(remainder.getCoefficient(remainder.getDegree()), inverseDenominatorLeadingTerm);
|
|
||||||
ModulusPoly term = other.multiplyByMonomial(degreeDifference, scale);
|
|
||||||
ModulusPoly iterationQuotient = field.buildMonomial(degreeDifference, scale);
|
|
||||||
quotient = quotient.add(iterationQuotient);
|
|
||||||
remainder = remainder.subtract(term);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new ModulusPoly[] { quotient, remainder };
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder result = new StringBuilder(8 * getDegree());
|
StringBuilder result = new StringBuilder(8 * getDegree());
|
||||||
|
|
|
@ -47,12 +47,6 @@ public final class BarcodeMatrix {
|
||||||
matrix[y].set(x, value);
|
matrix[y].set(x, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
void setMatrix(int x, int y, boolean black) {
|
|
||||||
set(x, y, (byte) (black ? 1 : 0));
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
void startRow() {
|
void startRow() {
|
||||||
++currentRow;
|
++currentRow;
|
||||||
}
|
}
|
||||||
|
@ -65,12 +59,6 @@ public final class BarcodeMatrix {
|
||||||
return getScaledMatrix(1, 1);
|
return getScaledMatrix(1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
public byte[][] getScaledMatrix(int scale) {
|
|
||||||
return getScaledMatrix(scale, scale);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
public byte[][] getScaledMatrix(int xScale, int yScale) {
|
public byte[][] getScaledMatrix(int xScale, int yScale) {
|
||||||
byte[][] matrixOut = new byte[height * yScale][width * xScale];
|
byte[][] matrixOut = new byte[height * yScale][width * xScale];
|
||||||
int yMax = height * yScale;
|
int yMax = height * yScale;
|
||||||
|
|
|
@ -63,12 +63,6 @@ final class BarcodeRow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
byte[] getRow() {
|
|
||||||
return row;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function scales the row
|
* This function scales the row
|
||||||
*
|
*
|
||||||
|
|
|
@ -48,12 +48,6 @@ public final class FinderPattern extends ResultPoint {
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
void incrementCount() {
|
|
||||||
this.count++;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Determines if this finder pattern "about equals" a finder pattern at the stated
|
* <p>Determines if this finder pattern "about equals" a finder pattern at the stated
|
||||||
* position and size -- meaning, it is at nearly the same center with nearly the same size.</p>
|
* position and size -- meaning, it is at nearly the same center with nearly the same size.</p>
|
||||||
|
|
|
@ -57,7 +57,7 @@ public final class EncoderTest extends Assert {
|
||||||
// real life tests
|
// real life tests
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEncode1() throws FormatException {
|
public void testEncode1() {
|
||||||
testEncode("This is an example Aztec symbol for Wikipedia.", true, 3,
|
testEncode("This is an example Aztec symbol for Wikipedia.", true, 3,
|
||||||
"X X X X X X X X \n" +
|
"X X X X X X X X \n" +
|
||||||
"X X X X X X X X X X \n" +
|
"X X X X X X X X X X \n" +
|
||||||
|
@ -85,7 +85,7 @@ public final class EncoderTest extends Assert {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEncode2() throws FormatException {
|
public void testEncode2() {
|
||||||
testEncode("Aztec Code is a public domain 2D matrix barcode symbology" +
|
testEncode("Aztec Code is a public domain 2D matrix barcode symbology" +
|
||||||
" of nominally square symbols built on a square grid with a " +
|
" of nominally square symbols built on a square grid with a " +
|
||||||
"distinctive square bullseye pattern at their center.", false, 6,
|
"distinctive square bullseye pattern at their center.", false, 6,
|
||||||
|
@ -426,7 +426,7 @@ public final class EncoderTest extends Assert {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUserSpecifiedLayers() throws FormatException {
|
public void testUserSpecifiedLayers() {
|
||||||
String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
AztecCode aztec = Encoder.encode(alphabet, 25, -2);
|
AztecCode aztec = Encoder.encode(alphabet, 25, -2);
|
||||||
assertEquals(2, aztec.getLayers());
|
assertEquals(2, aztec.getLayers());
|
||||||
|
@ -452,7 +452,7 @@ public final class EncoderTest extends Assert {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBorderCompact4Case() throws FormatException {
|
public void testBorderCompact4Case() {
|
||||||
// Compact(4) con hold 608 bits of information, but at most 504 can be data. Rest must
|
// Compact(4) con hold 608 bits of information, but at most 504 can be data. Rest must
|
||||||
// be error correction
|
// be error correction
|
||||||
String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
|
@ -479,7 +479,7 @@ public final class EncoderTest extends Assert {
|
||||||
|
|
||||||
// Helper routines
|
// Helper routines
|
||||||
|
|
||||||
private static void testEncode(String data, boolean compact, int layers, String expected) throws FormatException {
|
private static void testEncode(String data, boolean compact, int layers, String expected) {
|
||||||
AztecCode aztec = Encoder.encode(data, 33, Encoder.DEFAULT_AZTEC_LAYERS);
|
AztecCode aztec = Encoder.encode(data, 33, Encoder.DEFAULT_AZTEC_LAYERS);
|
||||||
assertEquals("Unexpected symbol format (compact)", compact, aztec.isCompact());
|
assertEquals("Unexpected symbol format (compact)", compact, aztec.isCompact());
|
||||||
assertEquals("Unexpected nr. of layers", layers, aztec.getLayers());
|
assertEquals("Unexpected nr. of layers", layers, aztec.getLayers());
|
||||||
|
|
|
@ -308,42 +308,6 @@ public final class ParsedReaderResultTestCase extends Assert {
|
||||||
"212-555-1212\nHere's a longer message. Should be fine.", ParsedResultType.SMS);
|
"212-555-1212\nHere's a longer message. Should be fine.", ParsedResultType.SMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
@Test
|
|
||||||
public void testNDEFText() {
|
|
||||||
doTestResult(new byte[] {(byte)0xD1,(byte)0x01,(byte)0x05,(byte)0x54,
|
|
||||||
(byte)0x02,(byte)0x65,(byte)0x6E,(byte)0x68,
|
|
||||||
(byte)0x69},
|
|
||||||
ParsedResultType.TEXT);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testNDEFURI() {
|
|
||||||
doTestResult(new byte[] {(byte)0xD1,(byte)0x01,(byte)0x08,(byte)0x55,
|
|
||||||
(byte)0x01,(byte)0x6E,(byte)0x66,(byte)0x63,
|
|
||||||
(byte)0x2E,(byte)0x63,(byte)0x6F,(byte)0x6D},
|
|
||||||
ParsedResultType.URI);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testNDEFSmartPoster() {
|
|
||||||
doTestResult(new byte[] {(byte)0xD1,(byte)0x02,(byte)0x2F,(byte)0x53,
|
|
||||||
(byte)0x70,(byte)0x91,(byte)0x01,(byte)0x0E,
|
|
||||||
(byte)0x55,(byte)0x01,(byte)0x6E,(byte)0x66,
|
|
||||||
(byte)0x63,(byte)0x2D,(byte)0x66,(byte)0x6F,
|
|
||||||
(byte)0x72,(byte)0x75,(byte)0x6D,(byte)0x2E,
|
|
||||||
(byte)0x6F,(byte)0x72,(byte)0x67,(byte)0x11,
|
|
||||||
(byte)0x03,(byte)0x01,(byte)0x61,(byte)0x63,
|
|
||||||
(byte)0x74,(byte)0x00,(byte)0x51,(byte)0x01,
|
|
||||||
(byte)0x12,(byte)0x54,(byte)0x05,(byte)0x65,
|
|
||||||
(byte)0x6E,(byte)0x2D,(byte)0x55,(byte)0x53,
|
|
||||||
(byte)0x48,(byte)0x65,(byte)0x6C,(byte)0x6C,
|
|
||||||
(byte)0x6F,(byte)0x2C,(byte)0x20,(byte)0x77,
|
|
||||||
(byte)0x6F,(byte)0x72,(byte)0x6C,(byte)0x64},
|
|
||||||
ParsedResultType.NDEF_SMART_POSTER);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
private static void doTestResult(String contents,
|
private static void doTestResult(String contents,
|
||||||
String goldenResult,
|
String goldenResult,
|
||||||
ParsedResultType type) {
|
ParsedResultType type) {
|
||||||
|
|
|
@ -16,11 +16,8 @@
|
||||||
|
|
||||||
package com.google.zxing.datamatrix.encoder;
|
package com.google.zxing.datamatrix.encoder;
|
||||||
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
|
|
||||||
import junit.framework.ComparisonFailure;
|
import junit.framework.ComparisonFailure;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Ignore;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -356,22 +353,6 @@ public final class HighLevelEncodeTestCase extends Assert {
|
||||||
assertEquals("238 10 99 164 204 254 240 82 220 70 180 209 83 80 80 200", visualized);
|
assertEquals("238 10 99 164 204 254 240 82 220 70 180 209 83 80 80 200", visualized);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore
|
|
||||||
@Test
|
|
||||||
public void testDataURL() {
|
|
||||||
|
|
||||||
byte[] data = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
|
|
||||||
0x7E, 0x7F, (byte) 0x80, (byte) 0x81, (byte) 0x82};
|
|
||||||
String expected = encodeHighLevel(new String(data, StandardCharsets.ISO_8859_1));
|
|
||||||
String visualized = encodeHighLevel("url(data:text/plain;charset=iso-8859-1,"
|
|
||||||
+ "%00%01%02%03%04%05%06%07%08%09%0A%7E%7F%80%81%82)");
|
|
||||||
assertEquals(expected, visualized);
|
|
||||||
assertEquals("1 2 3 4 5 6 7 8 9 10 11 231 153 173 67 218 112 7", visualized);
|
|
||||||
|
|
||||||
visualized = encodeHighLevel("url(data:;base64,flRlc3R+)");
|
|
||||||
assertEquals("127 85 102 116 117 127 129 56", visualized);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String encodeHighLevel(String msg) {
|
private static String encodeHighLevel(String msg) {
|
||||||
CharSequence encoded = HighLevelEncoder.encodeHighLevel(msg);
|
CharSequence encoded = HighLevelEncoder.encodeHighLevel(msg);
|
||||||
//DecodeHighLevel.decode(encoded);
|
//DecodeHighLevel.decode(encoded);
|
||||||
|
|
|
@ -28,9 +28,6 @@ public final class Maxicode1TestCase extends AbstractBlackBoxTestCase {
|
||||||
public Maxicode1TestCase() {
|
public Maxicode1TestCase() {
|
||||||
super("src/test/resources/blackbox/maxicode-1", new MultiFormatReader(), BarcodeFormat.MAXICODE);
|
super("src/test/resources/blackbox/maxicode-1", new MultiFormatReader(), BarcodeFormat.MAXICODE);
|
||||||
addTest(5, 5, 0.0f);
|
addTest(5, 5, 0.0f);
|
||||||
//addTest(5, 5, 90.0f);
|
|
||||||
//addTest(5, 5, 180.0f);
|
|
||||||
//addTest(5, 5, 270.0f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -18,7 +18,6 @@ package com.google.zxing.pdf417.decoder.ec;
|
||||||
|
|
||||||
import com.google.zxing.ChecksumException;
|
import com.google.zxing.ChecksumException;
|
||||||
|
|
||||||
import org.junit.Ignore;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
@ -85,31 +84,6 @@ public final class ErrorCorrectionTestCase extends AbstractErrorCorrectionTestCa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore("Erasures not implemented yet")
|
|
||||||
@Test
|
|
||||||
public void testMaxErasures() throws ChecksumException {
|
|
||||||
Random random = getRandom();
|
|
||||||
for (int test : PDF417_TEST) { // # iterations is kind of arbitrary
|
|
||||||
int[] received = PDF417_TEST_WITH_EC.clone();
|
|
||||||
int[] erasures = erase(received, MAX_ERASURES, random);
|
|
||||||
checkDecode(received, erasures);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Ignore("Erasures not implemented yet")
|
|
||||||
@Test
|
|
||||||
public void testTooManyErasures() {
|
|
||||||
Random random = getRandom();
|
|
||||||
int[] received = PDF417_TEST_WITH_EC.clone();
|
|
||||||
int[] erasures = erase(received, MAX_ERASURES + 1, random);
|
|
||||||
try {
|
|
||||||
checkDecode(received, erasures);
|
|
||||||
fail("Should not have decoded");
|
|
||||||
} catch (ChecksumException ce) {
|
|
||||||
// good
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkDecode(int[] received) throws ChecksumException {
|
private void checkDecode(int[] received) throws ChecksumException {
|
||||||
checkDecode(received, new int[0]);
|
checkDecode(received, new int[0]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ public final class EncoderTestCase extends Assert {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testChooseMode() throws WriterException {
|
public void testChooseMode() {
|
||||||
// Numeric mode.
|
// Numeric mode.
|
||||||
assertSame(Mode.NUMERIC, Encoder.chooseMode("0"));
|
assertSame(Mode.NUMERIC, Encoder.chooseMode("0"));
|
||||||
assertSame(Mode.NUMERIC, Encoder.chooseMode("0123456789"));
|
assertSame(Mode.NUMERIC, Encoder.chooseMode("0123456789"));
|
||||||
|
@ -580,7 +580,7 @@ public final class EncoderTestCase extends Assert {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAppend8BitBytes() throws WriterException {
|
public void testAppend8BitBytes() {
|
||||||
// 0x61, 0x62, 0x63
|
// 0x61, 0x62, 0x63
|
||||||
BitArray bits = new BitArray();
|
BitArray bits = new BitArray();
|
||||||
Encoder.append8BitBytes("abc", bits, Encoder.DEFAULT_BYTE_MODE_ENCODING);
|
Encoder.append8BitBytes("abc", bits, Encoder.DEFAULT_BYTE_MODE_ENCODING);
|
||||||
|
|
5
pom.xml
5
pom.xml
|
@ -66,7 +66,7 @@
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
<android.home>${env.ANDROID_HOME}</android.home>
|
<android.home>${env.ANDROID_HOME}</android.home>
|
||||||
<proguard.version>7.0.0</proguard.version>
|
<proguard.version>7.0.1</proguard.version>
|
||||||
<proguard.plugin.version>2.3.1</proguard.plugin.version>
|
<proguard.plugin.version>2.3.1</proguard.plugin.version>
|
||||||
<!-- This can't reference project.version as some subprojects version differently -->
|
<!-- This can't reference project.version as some subprojects version differently -->
|
||||||
<zxing.version>3.4.2-SNAPSHOT</zxing.version>
|
<zxing.version>3.4.2-SNAPSHOT</zxing.version>
|
||||||
|
@ -168,7 +168,6 @@
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
<version>3.2.0</version>
|
<version>3.2.0</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<javadocVersion>${java.version}</javadocVersion>
|
|
||||||
<source>${java.version}</source>
|
<source>${java.version}</source>
|
||||||
<quiet>true</quiet>
|
<quiet>true</quiet>
|
||||||
<notimestamp>true</notimestamp>
|
<notimestamp>true</notimestamp>
|
||||||
|
@ -443,7 +442,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.puppycrawl.tools</groupId>
|
<groupId>com.puppycrawl.tools</groupId>
|
||||||
<artifactId>checkstyle</artifactId>
|
<artifactId>checkstyle</artifactId>
|
||||||
<version>8.36.2</version>
|
<version>8.38</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.guava</groupId>
|
<groupId>com.google.guava</groupId>
|
||||||
<artifactId>guava</artifactId>
|
<artifactId>guava</artifactId>
|
||||||
<version>29.0-android</version>
|
<version>30.0-android</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
|
@ -49,7 +49,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-test</artifactId>
|
<artifactId>spring-test</artifactId>
|
||||||
<version>5.2.9.RELEASE</version>
|
<version>5.3.1</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
Loading…
Reference in a new issue