From 0a8f5e5990a6ea879582eb1ba42ec696ed6f2047 Mon Sep 17 00:00:00 2001 From: srowen Date: Sun, 2 May 2010 06:49:18 +0000 Subject: [PATCH] Replace tabs with spaces ( part of accepting another big patch); fix one failing test due to typo git-svn-id: http://zxing.googlecode.com/svn/trunk@1326 59b500cc-1b3d-0410-9834-0bbf25fbcc57 --- .../integration/android/IntentIntegrator.java | 6 +- .../zxing/client/android/CaptureActivity.java | 4 +- .../book/SearchBookContentsActivity.java | 6 +- .../book/SearchBookContentsResult.java | 6 +- .../android/result/URIResultHandler.java | 2 +- .../decoder/DecodedBitStreamParser.java | 82 +++++++------- .../com/google/zxing/oned/Code128Writer.java | 56 ++++----- .../com/google/zxing/oned/Code39Writer.java | 91 ++++++++------- core/src/com/google/zxing/oned/ITFReader.java | 8 +- core/src/com/google/zxing/oned/ITFWriter.java | 66 ++++++----- .../decoder/DecodedBitStreamParser.java | 2 +- .../google/zxing/pdf417/decoder/Decoder.java | 3 +- .../result/ParsedReaderResultTestCase.java | 6 +- .../zxing/qrcode/encoder/EncoderTestCase.java | 24 ++-- .../qrcode/encoder/MatrixUtilTestCase.java | 107 +++++++++--------- .../zxing/qrcode/encoder/QRCodeTestCase.java | 90 +++++++-------- jruby/lib/zxing.rb | 4 +- .../zxing/web/generator/Generator.gwt.xml | 5 - .../generator/client/GeneratorException.java | 8 +- .../zxing/web/generator/public/Generator.css | 18 --- zxing.appspot.com/static/style.css | 34 +++--- 21 files changed, 303 insertions(+), 325 deletions(-) diff --git a/android-integration/src/com/google/zxing/integration/android/IntentIntegrator.java b/android-integration/src/com/google/zxing/integration/android/IntentIntegrator.java index c4c28662..b92f86c7 100644 --- a/android-integration/src/com/google/zxing/integration/android/IntentIntegrator.java +++ b/android-integration/src/com/google/zxing/integration/android/IntentIntegrator.java @@ -137,7 +137,7 @@ public final class IntentIntegrator { CharSequence stringButtonYes, CharSequence stringButtonNo) { - return initiateScan(activity, + return initiateScan(activity, stringTitle, stringMessage, stringButtonYes, @@ -171,8 +171,8 @@ public final class IntentIntegrator { // check which types of codes to scan for if (stringDesiredBarcodeFormats != null) { - // set the desired barcode types - intentScan.putExtra("SCAN_FORMATS", stringDesiredBarcodeFormats); + // set the desired barcode types + intentScan.putExtra("SCAN_FORMATS", stringDesiredBarcodeFormats); } try { diff --git a/android/src/com/google/zxing/client/android/CaptureActivity.java b/android/src/com/google/zxing/client/android/CaptureActivity.java index f0b8e6f1..6b583240 100755 --- a/android/src/com/google/zxing/client/android/CaptureActivity.java +++ b/android/src/com/google/zxing/client/android/CaptureActivity.java @@ -588,8 +588,8 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal resultHandler.getDisplayContents().toString() + "&source=zxing"; handler.sendMessageDelayed(message, INTENT_RESULT_DURATION); } else if (source == Source.ZXING_LINK) { - // Replace each occurrence of RETURN_CODE_PLACEHOLDER in the returnUrlTemplate - // with the scanned code. This allows both queries and REST-style URLs to work. + // Replace each occurrence of RETURN_CODE_PLACEHOLDER in the returnUrlTemplate + // with the scanned code. This allows both queries and REST-style URLs to work. Message message = Message.obtain(handler, R.id.launch_product_query); message.obj = returnUrlTemplate.replace(RETURN_CODE_PLACEHOLDER, resultHandler.getDisplayContents().toString()); handler.sendMessageDelayed(message, INTENT_RESULT_DURATION); diff --git a/android/src/com/google/zxing/client/android/book/SearchBookContentsActivity.java b/android/src/com/google/zxing/client/android/book/SearchBookContentsActivity.java index dfc1e5a7..cc8e80ce 100644 --- a/android/src/com/google/zxing/client/android/book/SearchBookContentsActivity.java +++ b/android/src/com/google/zxing/client/android/book/SearchBookContentsActivity.java @@ -199,7 +199,7 @@ public final class SearchBookContentsActivity extends Activity { for (int x = 0; x < count; x++) { items.add(parseResult(results.getJSONObject(x))); } - resultListView.setOnItemClickListener(new BrowseBookListener(this, items)); + resultListView.setOnItemClickListener(new BrowseBookListener(this, items)); resultListView.setAdapter(new SearchBookContentsAdapter(this, items)); } else { String searchable = json.optString("searchable"); @@ -243,7 +243,7 @@ public final class SearchBookContentsActivity extends Activity { return new SearchBookContentsResult(pageId, pageNumber, snippet, valid); } catch (JSONException e) { // Never seen in the wild, just being complete. - return new SearchBookContentsResult(getString(R.string.msg_sbc_no_page_returned), "", "", false); + return new SearchBookContentsResult(getString(R.string.msg_sbc_no_page_returned), "", "", false); } } @@ -267,7 +267,7 @@ public final class SearchBookContentsActivity extends Activity { // website, we don't use LocaleManager to change the TLD. URI uri; if (isbn.startsWith("http://google.com/books?id=")) { - int equals = isbn.indexOf('='); + int equals = isbn.indexOf('='); String volumeId = isbn.substring(equals + 1); uri = new URI("http", null, "www.google.com", -1, "/books", "id=" + volumeId + "&jscmd=SearchWithinVolume2&q=" + query, null); diff --git a/android/src/com/google/zxing/client/android/book/SearchBookContentsResult.java b/android/src/com/google/zxing/client/android/book/SearchBookContentsResult.java index cd794b71..9cd5c180 100644 --- a/android/src/com/google/zxing/client/android/book/SearchBookContentsResult.java +++ b/android/src/com/google/zxing/client/android/book/SearchBookContentsResult.java @@ -30,8 +30,10 @@ final class SearchBookContentsResult { private final String snippet; private final boolean validSnippet; - SearchBookContentsResult(String pageId, String pageNumber, String snippet, - boolean validSnippet) { + SearchBookContentsResult(String pageId, + String pageNumber, + String snippet, + boolean validSnippet) { this.pageId = pageId; this.pageNumber = pageNumber; this.snippet = snippet; diff --git a/android/src/com/google/zxing/client/android/result/URIResultHandler.java b/android/src/com/google/zxing/client/android/result/URIResultHandler.java index 7a8e4e9e..1f144258 100644 --- a/android/src/com/google/zxing/client/android/result/URIResultHandler.java +++ b/android/src/com/google/zxing/client/android/result/URIResultHandler.java @@ -65,7 +65,7 @@ public final class URIResultHandler extends ResultHandler { shareBySMS(uri); break; case 3: - searchBookContents(uri); + searchBookContents(uri); break; } } diff --git a/core/src/com/google/zxing/datamatrix/decoder/DecodedBitStreamParser.java b/core/src/com/google/zxing/datamatrix/decoder/DecodedBitStreamParser.java index d842f9c9..ccea54fe 100644 --- a/core/src/com/google/zxing/datamatrix/decoder/DecodedBitStreamParser.java +++ b/core/src/com/google/zxing/datamatrix/decoder/DecodedBitStreamParser.java @@ -47,7 +47,7 @@ final class DecodedBitStreamParser { private static final char[] C40_SHIFT2_SET_CHARS = { '!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '^', '_' - }; + }; /** * See ISO 16022:2006, Annex C Table C.2 @@ -122,54 +122,54 @@ final class DecodedBitStreamParser { do { int oneByte = bits.readBits(8); if (oneByte == 0) { - throw FormatException.getFormatInstance(); - } else if (oneByte <= 128) { // ASCII data (ASCII value + 1) - oneByte = upperShift ? (oneByte + 128) : oneByte; - upperShift = false; - result.append((char) (oneByte - 1)); - return ASCII_ENCODE; - } else if (oneByte == 129) { // Pad - return PAD_ENCODE; - } else if (oneByte <= 229) { // 2-digit data 00-99 (Numeric Value + 130) - int value = oneByte - 130; - if (value < 10) { // padd with '0' for single digit values - result.append('0'); - } - result.append(value); - } else if (oneByte == 230) { // Latch to C40 encodation - return C40_ENCODE; - } else if (oneByte == 231) { // Latch to Base 256 encodation - return BASE256_ENCODE; - } else if (oneByte == 232) { // FNC1 - //throw ReaderException.getInstance(); + throw FormatException.getFormatInstance(); + } else if (oneByte <= 128) { // ASCII data (ASCII value + 1) + oneByte = upperShift ? (oneByte + 128) : oneByte; + upperShift = false; + result.append((char) (oneByte - 1)); + return ASCII_ENCODE; + } else if (oneByte == 129) { // Pad + return PAD_ENCODE; + } else if (oneByte <= 229) { // 2-digit data 00-99 (Numeric Value + 130) + int value = oneByte - 130; + if (value < 10) { // padd with '0' for single digit values + result.append('0'); + } + result.append(value); + } else if (oneByte == 230) { // Latch to C40 encodation + return C40_ENCODE; + } else if (oneByte == 231) { // Latch to Base 256 encodation + return BASE256_ENCODE; + } else if (oneByte == 232) { // FNC1 + //throw ReaderException.getInstance(); // Ignore this symbol for now - } else if (oneByte == 233) { // Structured Append - //throw ReaderException.getInstance(); + } else if (oneByte == 233) { // Structured Append + //throw ReaderException.getInstance(); // Ignore this symbol for now - } else if (oneByte == 234) { // Reader Programming - //throw ReaderException.getInstance(); + } else if (oneByte == 234) { // Reader Programming + //throw ReaderException.getInstance(); // Ignore this symbol for now - } else if (oneByte == 235) { // Upper Shift (shift to Extended ASCII) - upperShift = true; - } else if (oneByte == 236) { // 05 Macro + } else if (oneByte == 235) { // Upper Shift (shift to Extended ASCII) + upperShift = true; + } else if (oneByte == 236) { // 05 Macro result.append("[)>\u001E05\u001D"); resultTrailer.insert(0, "\u001E\u0004"); } else if (oneByte == 237) { // 06 Macro - result.append("[)>\u001E06\u001D"); + result.append("[)>\u001E06\u001D"); resultTrailer.insert(0, "\u001E\u0004"); - } else if (oneByte == 238) { // Latch to ANSI X12 encodation - return ANSIX12_ENCODE; - } else if (oneByte == 239) { // Latch to Text encodation - return TEXT_ENCODE; - } else if (oneByte == 240) { // Latch to EDIFACT encodation - return EDIFACT_ENCODE; - } else if (oneByte == 241) { // ECI Character - // TODO(bbrown): I think we need to support ECI - //throw ReaderException.getInstance(); + } else if (oneByte == 238) { // Latch to ANSI X12 encodation + return ANSIX12_ENCODE; + } else if (oneByte == 239) { // Latch to Text encodation + return TEXT_ENCODE; + } else if (oneByte == 240) { // Latch to EDIFACT encodation + return EDIFACT_ENCODE; + } else if (oneByte == 241) { // ECI Character + // TODO(bbrown): I think we need to support ECI + //throw ReaderException.getInstance(); // Ignore this symbol for now - } else if (oneByte >= 242) { // Not to be used in ASCII encodation - throw FormatException.getFormatInstance(); - } + } else if (oneByte >= 242) { // Not to be used in ASCII encodation + throw FormatException.getFormatInstance(); + } } while (bits.available() > 0); return ASCII_ENCODE; } diff --git a/core/src/com/google/zxing/oned/Code128Writer.java b/core/src/com/google/zxing/oned/Code128Writer.java index 0c226261..22a5d666 100644 --- a/core/src/com/google/zxing/oned/Code128Writer.java +++ b/core/src/com/google/zxing/oned/Code128Writer.java @@ -28,46 +28,46 @@ import com.google.zxing.common.BitMatrix; */ public final class Code128Writer extends UPCEANWriter { - public BitMatrix encode(String contents, + public BitMatrix encode(String contents, BarcodeFormat format, int width, int height, Hashtable hints) throws WriterException { - if (format != BarcodeFormat.CODE_128) { - throw new IllegalArgumentException("Can only encode CODE_128, but got " + format); - } - return super.encode(contents, format, width, height, hints); - } + if (format != BarcodeFormat.CODE_128) { + throw new IllegalArgumentException("Can only encode CODE_128, but got " + format); + } + return super.encode(contents, format, width, height, hints); + } - public byte[] encode(String contents) { + public byte[] encode(String contents) { int length = contents.length(); - if (length > 80) { - throw new IllegalArgumentException( - "Requested contents should be less than 80 digits long, but got " + length); - } + if (length > 80) { + throw new IllegalArgumentException( + "Requested contents should be less than 80 digits long, but got " + length); + } - int codeWidth = 11 + 11 + 13; //start plus check plus stop character - //get total code width for this barcode - for (int i = 0; i < length; i++) { + int codeWidth = 11 + 11 + 13; //start plus check plus stop character + //get total code width for this barcode + for (int i = 0; i < length; i++) { int[] patterns = Code128Reader.CODE_PATTERNS[contents.charAt(i) - ' ']; - for (int j = 0; j < patterns.length; j++) { - codeWidth += patterns[j]; - } - } - byte[] result = new byte[codeWidth]; + for (int j = 0; j < patterns.length; j++) { + codeWidth += patterns[j]; + } + } + byte[] result = new byte[codeWidth]; int pos = appendPattern(result, 0, Code128Reader.CODE_PATTERNS[104], 1); int check = 104; - //append next character to bytematrix - for(int i = 0; i < length; i++) { + //append next character to bytematrix + for(int i = 0; i < length; i++) { check += (contents.charAt(i) - ' ') * (i + 1); - pos += appendPattern(result, pos, Code128Reader.CODE_PATTERNS[contents.charAt(i) - ' '],1); - } - //compute checksum and append it along with end character and quiet space + pos += appendPattern(result, pos, Code128Reader.CODE_PATTERNS[contents.charAt(i) - ' '],1); + } + //compute checksum and append it along with end character and quiet space check %= 103; - pos += appendPattern(result,pos,Code128Reader.CODE_PATTERNS[check],1); - pos += appendPattern(result,pos,Code128Reader.CODE_PATTERNS[106],1); + pos += appendPattern(result,pos,Code128Reader.CODE_PATTERNS[check],1); + pos += appendPattern(result,pos,Code128Reader.CODE_PATTERNS[106],1); - return result; - } + return result; + } } \ No newline at end of file diff --git a/core/src/com/google/zxing/oned/Code39Writer.java b/core/src/com/google/zxing/oned/Code39Writer.java index fab63b2f..dc9cc243 100644 --- a/core/src/com/google/zxing/oned/Code39Writer.java +++ b/core/src/com/google/zxing/oned/Code39Writer.java @@ -28,52 +28,55 @@ import com.google.zxing.common.BitMatrix; */ public final class Code39Writer extends UPCEANWriter { - public BitMatrix encode(String contents, BarcodeFormat format, int width, int height, - Hashtable hints) throws WriterException { - if (format != BarcodeFormat.CODE_39) { - throw new IllegalArgumentException("Can only encode CODE_39, but got " + format); - } - return super.encode(contents, format, width, height, hints); - } + public BitMatrix encode(String contents, + BarcodeFormat format, + int width, + int height, + Hashtable hints) throws WriterException { + if (format != BarcodeFormat.CODE_39) { + throw new IllegalArgumentException("Can only encode CODE_39, but got " + format); + } + return super.encode(contents, format, width, height, hints); + } - public byte[] encode(String contents) { - int length = contents.length(); - if (length > 80) { - throw new IllegalArgumentException( - "Requested contents should be less than 80 digits long, but got " + length); - } + public byte[] encode(String contents) { + int length = contents.length(); + if (length > 80) { + throw new IllegalArgumentException( + "Requested contents should be less than 80 digits long, but got " + length); + } - int[] widths = new int[9]; - int codeWidth = 24 + 1 + length; - for (int i = 0; i < length; i++) { - int indexInString = Code39Reader.ALPHABET_STRING.indexOf(contents.charAt(i)); - toIntArray(Code39Reader.CHARACTER_ENCODINGS[indexInString], widths); - for(int j = 0; j < widths.length; j++) { - codeWidth += widths[j]; - } - } - byte[] result = new byte[codeWidth]; - toIntArray(Code39Reader.CHARACTER_ENCODINGS[39], widths); - int pos = appendPattern(result, 0, widths, 1); - int[] narrowWhite = {1}; + int[] widths = new int[9]; + int codeWidth = 24 + 1 + length; + for (int i = 0; i < length; i++) { + int indexInString = Code39Reader.ALPHABET_STRING.indexOf(contents.charAt(i)); + toIntArray(Code39Reader.CHARACTER_ENCODINGS[indexInString], widths); + for(int j = 0; j < widths.length; j++) { + codeWidth += widths[j]; + } + } + byte[] result = new byte[codeWidth]; + toIntArray(Code39Reader.CHARACTER_ENCODINGS[39], widths); + int pos = appendPattern(result, 0, widths, 1); + int[] narrowWhite = {1}; + pos += appendPattern(result, pos, narrowWhite, 0); + //append next character to bytematrix + for(int i = length-1; i >= 0; i--) { + int indexInString = Code39Reader.ALPHABET_STRING.indexOf(contents.charAt(i)); + toIntArray(Code39Reader.CHARACTER_ENCODINGS[indexInString], widths); + pos += appendPattern(result, pos, widths, 1); pos += appendPattern(result, pos, narrowWhite, 0); - //append next character to bytematrix - for(int i = length-1; i >= 0; i--) { - int indexInString = Code39Reader.ALPHABET_STRING.indexOf(contents.charAt(i)); - toIntArray(Code39Reader.CHARACTER_ENCODINGS[indexInString], widths); - pos += appendPattern(result, pos, widths, 1); - pos += appendPattern(result, pos, narrowWhite, 0); - } - toIntArray(Code39Reader.CHARACTER_ENCODINGS[39], widths); - pos += appendPattern(result, pos, widths, 1); - return result; - } - - private static void toIntArray(int a, int[] toReturn) { - for (int i = 0; i < 9; i++) { - int temp = a & (1 << i); - toReturn[i] = (temp == 0) ? 1 : 2; - } - } + } + toIntArray(Code39Reader.CHARACTER_ENCODINGS[39], widths); + pos += appendPattern(result, pos, widths, 1); + return result; + } + + private static void toIntArray(int a, int[] toReturn) { + for (int i = 0; i < 9; i++) { + int temp = a & (1 << i); + toReturn[i] = (temp == 0) ? 1 : 2; + } + } } \ No newline at end of file diff --git a/core/src/com/google/zxing/oned/ITFReader.java b/core/src/com/google/zxing/oned/ITFReader.java index 74e5acb8..c1877689 100644 --- a/core/src/com/google/zxing/oned/ITFReader.java +++ b/core/src/com/google/zxing/oned/ITFReader.java @@ -340,9 +340,9 @@ public final class ITFReader extends OneDReader { } if (bestMatch >= 0) { return bestMatch; - } else { - throw NotFoundException.getNotFoundInstance(); - } - } + } else { + throw NotFoundException.getNotFoundInstance(); + } + } } diff --git a/core/src/com/google/zxing/oned/ITFWriter.java b/core/src/com/google/zxing/oned/ITFWriter.java index b85a6521..1967c55f 100644 --- a/core/src/com/google/zxing/oned/ITFWriter.java +++ b/core/src/com/google/zxing/oned/ITFWriter.java @@ -28,37 +28,41 @@ import com.google.zxing.common.BitMatrix; */ public final class ITFWriter extends UPCEANWriter { - public BitMatrix encode(String contents, BarcodeFormat format, int width, int height, - Hashtable hints) throws WriterException { - if (format != BarcodeFormat.ITF) { - throw new IllegalArgumentException("Can only encode ITF, but got " + format); - } - - return super.encode(contents, format, width, height, hints); - } + public BitMatrix encode(String contents, + BarcodeFormat format, + int width, + int height, + Hashtable hints) throws WriterException { + if (format != BarcodeFormat.ITF) { + throw new IllegalArgumentException("Can only encode ITF, but got " + format); + } - public byte[] encode(String contents) { - int length = contents.length(); - if (length > 80) { - throw new IllegalArgumentException( - "Requested contents should be less than 80 digits long, but got " + length); - } - byte[] result = new byte[9 + 9 * length]; - int[] start = {1, 1, 1, 1}; - int pos = appendPattern(result, 0, start, 1); - for (int i = 0; i < length; i += 2) { - int one = Character.digit(contents.charAt(i), 10); - int two = Character.digit(contents.charAt(i+1), 10); - int[] encoding = new int[18]; - for (int j = 0; j < 10; j += 2) { - encoding[j] = ITFReader.PATTERNS[one][j]; - encoding[j + 1] = ITFReader.PATTERNS[two][j]; - } - pos += appendPattern(result, pos, encoding, 1); - } - int[] end = {3, 1, 1}; - pos += appendPattern(result, pos, end, 1); + return super.encode(contents, format, width, height, hints); + } + + public byte[] encode(String contents) { + int length = contents.length(); + if (length > 80) { + throw new IllegalArgumentException( + "Requested contents should be less than 80 digits long, but got " + length); + } + byte[] result = new byte[9 + 9 * length]; + int[] start = {1, 1, 1, 1}; + int pos = appendPattern(result, 0, start, 1); + for (int i = 0; i < length; i += 2) { + int one = Character.digit(contents.charAt(i), 10); + int two = Character.digit(contents.charAt(i+1), 10); + int[] encoding = new int[18]; + for (int j = 0; j < 10; j += 2) { + encoding[j] = ITFReader.PATTERNS[one][j]; + encoding[j + 1] = ITFReader.PATTERNS[two][j]; + } + pos += appendPattern(result, pos, encoding, 1); + } + int[] end = {3, 1, 1}; + pos += appendPattern(result, pos, end, 1); + + return result; + } - return result; - } } \ No newline at end of file diff --git a/core/src/com/google/zxing/pdf417/decoder/DecodedBitStreamParser.java b/core/src/com/google/zxing/pdf417/decoder/DecodedBitStreamParser.java index 8b801f37..a5048df2 100644 --- a/core/src/com/google/zxing/pdf417/decoder/DecodedBitStreamParser.java +++ b/core/src/com/google/zxing/pdf417/decoder/DecodedBitStreamParser.java @@ -446,7 +446,7 @@ final class DecodedBitStreamParser { code == BEGIN_MACRO_PDF417_CONTROL_BLOCK || code == BEGIN_MACRO_PDF417_OPTIONAL_FIELD || code == MACRO_PDF417_TERMINATOR) { - codeIndex--; + codeIndex--; end = true; } } diff --git a/core/src/com/google/zxing/pdf417/decoder/Decoder.java b/core/src/com/google/zxing/pdf417/decoder/Decoder.java index 1936c5af..ece3acd0 100644 --- a/core/src/com/google/zxing/pdf417/decoder/Decoder.java +++ b/core/src/com/google/zxing/pdf417/decoder/Decoder.java @@ -145,5 +145,6 @@ public final class Decoder { } } return result; - } + } + } diff --git a/core/test/src/com/google/zxing/client/result/ParsedReaderResultTestCase.java b/core/test/src/com/google/zxing/client/result/ParsedReaderResultTestCase.java index df663836..da5fec6b 100644 --- a/core/test/src/com/google/zxing/client/result/ParsedReaderResultTestCase.java +++ b/core/test/src/com/google/zxing/client/result/ParsedReaderResultTestCase.java @@ -202,11 +202,11 @@ public final class ParsedReaderResultTestCase extends TestCase { "DTEND:20080505\r\nEND:VEVENT", "foo\n20080504\n20080505", ParsedResultType.CALENDAR); // Start time only doTestResult("BEGIN:VEVENT\r\nSUMMARY:foo\r\nDTSTART:20080504T123456Z\r\nEND:VEVENT", - "foo\n20080504T123456Z", ParsedResultType.CALENDAR); + "foo\n20080504T123456Z\n20080504T123456Z", ParsedResultType.CALENDAR); doTestResult("BEGIN:VEVENT\r\nSUMMARY:foo\r\nDTSTART:20080504T123456\r\nEND:VEVENT", - "foo\n20080504T123456", ParsedResultType.CALENDAR); + "foo\n20080504T123456\n20080504T123456", ParsedResultType.CALENDAR); doTestResult("BEGIN:VEVENT\r\nSUMMARY:foo\r\nDTSTART:20080504\r\nEND:VEVENT", - "foo\n20080504", ParsedResultType.CALENDAR); + "foo\n20080504\n20080504", ParsedResultType.CALENDAR); doTestResult("BEGIN:VEVENT\r\nDTEND:20080505T\r\nEND:VEVENT", "BEGIN:VEVENT\r\nDTEND:20080505T\r\nEND:VEVENT", ParsedResultType.TEXT); // Make sure illegal entries without newlines don't crash diff --git a/core/test/src/com/google/zxing/qrcode/encoder/EncoderTestCase.java b/core/test/src/com/google/zxing/qrcode/encoder/EncoderTestCase.java index 89912fad..b452a8bd 100644 --- a/core/test/src/com/google/zxing/qrcode/encoder/EncoderTestCase.java +++ b/core/test/src/com/google/zxing/qrcode/encoder/EncoderTestCase.java @@ -136,33 +136,33 @@ public final class EncoderTestCase extends TestCase { { BitArray bits = new BitArray(); Encoder.appendLengthInfo(1, // 1 letter (1/1). - 1, // version 1. - Mode.NUMERIC, - bits); + 1, // version 1. + Mode.NUMERIC, + bits); assertEquals(" ........ .X", bits.toString()); // 10 bits. } { BitArray bits = new BitArray(); Encoder.appendLengthInfo(2, // 2 letters (2/1). - 10, // version 10. - Mode.ALPHANUMERIC, - bits); + 10, // version 10. + Mode.ALPHANUMERIC, + bits); assertEquals(" ........ .X.", bits.toString()); // 11 bits. } { BitArray bits = new BitArray(); Encoder.appendLengthInfo(255, // 255 letter (255/1). - 27, // version 27. - Mode.BYTE, - bits); + 27, // version 27. + Mode.BYTE, + bits); assertEquals(" ........ XXXXXXXX", bits.toString()); // 16 bits. } { BitArray bits = new BitArray(); Encoder.appendLengthInfo(512, // 512 letters (1024/2). - 40, // version 40. - Mode.KANJI, - bits); + 40, // version 40. + Mode.KANJI, + bits); assertEquals(" ..X..... ....", bits.toString()); // 12 bits. } } diff --git a/core/test/src/com/google/zxing/qrcode/encoder/MatrixUtilTestCase.java b/core/test/src/com/google/zxing/qrcode/encoder/MatrixUtilTestCase.java index 87336dc1..ecb8b4b8 100644 --- a/core/test/src/com/google/zxing/qrcode/encoder/MatrixUtilTestCase.java +++ b/core/test/src/com/google/zxing/qrcode/encoder/MatrixUtilTestCase.java @@ -54,27 +54,27 @@ public final class MatrixUtilTestCase extends TestCase { { // Version 1. String expected = - " 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1\n" + - " 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1\n" + - " 1 0 1 1 1 0 1 0 0 1 0 1 1 1 0 1\n" + - " 1 0 1 1 1 0 1 0 0 1 0 1 1 1 0 1\n" + - " 1 0 1 1 1 0 1 0 0 1 0 1 1 1 0 1\n" + - " 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1\n" + - " 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1\n" + - " 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" + - " 1 \n" + - " 0 \n" + - " 1 \n" + - " 0 \n" + - " 1 \n" + - " 0 0 0 0 0 0 0 0 1 \n" + - " 1 1 1 1 1 1 1 0 \n" + - " 1 0 0 0 0 0 1 0 \n" + - " 1 0 1 1 1 0 1 0 \n" + - " 1 0 1 1 1 0 1 0 \n" + - " 1 0 1 1 1 0 1 0 \n" + - " 1 0 0 0 0 0 1 0 \n" + - " 1 1 1 1 1 1 1 0 \n"; + " 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1\n" + + " 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1\n" + + " 1 0 1 1 1 0 1 0 0 1 0 1 1 1 0 1\n" + + " 1 0 1 1 1 0 1 0 0 1 0 1 1 1 0 1\n" + + " 1 0 1 1 1 0 1 0 0 1 0 1 1 1 0 1\n" + + " 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1\n" + + " 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1\n" + + " 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" + + " 1 \n" + + " 0 \n" + + " 1 \n" + + " 0 \n" + + " 1 \n" + + " 0 0 0 0 0 0 0 0 1 \n" + + " 1 1 1 1 1 1 1 0 \n" + + " 1 0 0 0 0 0 1 0 \n" + + " 1 0 1 1 1 0 1 0 \n" + + " 1 0 1 1 1 0 1 0 \n" + + " 1 0 1 1 1 0 1 0 \n" + + " 1 0 0 0 0 0 1 0 \n" + + " 1 1 1 1 1 1 1 0 \n"; ByteMatrix matrix = new ByteMatrix(21, 21); MatrixUtil.clearMatrix(matrix); MatrixUtil.embedBasicPatterns(1, matrix); @@ -84,31 +84,31 @@ public final class MatrixUtilTestCase extends TestCase { // Version 2. Position adjustment pattern should apppear at right // bottom corner. String expected = - " 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1\n" + - " 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1\n" + - " 1 0 1 1 1 0 1 0 0 1 0 1 1 1 0 1\n" + - " 1 0 1 1 1 0 1 0 0 1 0 1 1 1 0 1\n" + - " 1 0 1 1 1 0 1 0 0 1 0 1 1 1 0 1\n" + - " 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1\n" + - " 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1\n" + - " 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" + - " 1 \n" + - " 0 \n" + - " 1 \n" + - " 0 \n" + - " 1 \n" + - " 0 \n" + - " 1 \n" + - " 0 \n" + - " 1 1 1 1 1 1 \n" + - " 0 0 0 0 0 0 0 0 1 1 0 0 0 1 \n" + - " 1 1 1 1 1 1 1 0 1 0 1 0 1 \n" + - " 1 0 0 0 0 0 1 0 1 0 0 0 1 \n" + - " 1 0 1 1 1 0 1 0 1 1 1 1 1 \n" + - " 1 0 1 1 1 0 1 0 \n" + - " 1 0 1 1 1 0 1 0 \n" + - " 1 0 0 0 0 0 1 0 \n" + - " 1 1 1 1 1 1 1 0 \n"; + " 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1\n" + + " 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1\n" + + " 1 0 1 1 1 0 1 0 0 1 0 1 1 1 0 1\n" + + " 1 0 1 1 1 0 1 0 0 1 0 1 1 1 0 1\n" + + " 1 0 1 1 1 0 1 0 0 1 0 1 1 1 0 1\n" + + " 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1\n" + + " 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1\n" + + " 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" + + " 1 \n" + + " 0 \n" + + " 1 \n" + + " 0 \n" + + " 1 \n" + + " 0 \n" + + " 1 \n" + + " 0 \n" + + " 1 1 1 1 1 1 \n" + + " 0 0 0 0 0 0 0 0 1 1 0 0 0 1 \n" + + " 1 1 1 1 1 1 1 0 1 0 1 0 1 \n" + + " 1 0 0 0 0 0 1 0 1 0 0 0 1 \n" + + " 1 0 1 1 1 0 1 0 1 1 1 1 1 \n" + + " 1 0 1 1 1 0 1 0 \n" + + " 1 0 1 1 1 0 1 0 \n" + + " 1 0 0 0 0 0 1 0 \n" + + " 1 1 1 1 1 1 1 0 \n"; ByteMatrix matrix = new ByteMatrix(25, 25); MatrixUtil.clearMatrix(matrix); MatrixUtil.embedBasicPatterns(2, matrix); @@ -235,18 +235,18 @@ public final class MatrixUtilTestCase extends TestCase { " 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 0\n" + " 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 0 1 0 0 1 0\n"; char[] bytes = {32, 65, 205, 69, 41, 220, 46, 128, 236, - 42, 159, 74, 221, 244, 169, 239, 150, 138, - 70, 237, 85, 224, 96, 74, 219 , 61}; + 42, 159, 74, 221, 244, 169, 239, 150, 138, + 70, 237, 85, 224, 96, 74, 219 , 61}; BitArray bits = new BitArray(); for (char c: bytes) { bits.appendBits(c, 8); } ByteMatrix matrix = new ByteMatrix(21, 21); MatrixUtil.buildMatrix(bits, - ErrorCorrectionLevel.H, - 1, // Version 1 - 3, // Mask pattern 3 - matrix); + ErrorCorrectionLevel.H, + 1, // Version 1 + 3, // Mask pattern 3 + matrix); } public void testFindMSBSet() { @@ -290,8 +290,7 @@ public final class MatrixUtilTestCase extends TestCase { public void testMakeTypeInfoInfoBits() throws WriterException { // From Appendix C in JISX0510:2004 (p 65) BitArray bits = new BitArray(); - MatrixUtil.makeTypeInfoBits(ErrorCorrectionLevel.M, - 5, bits); + MatrixUtil.makeTypeInfoBits(ErrorCorrectionLevel.M, 5, bits); assertEquals(" X......X X..XXX.", bits.toString()); } } diff --git a/core/test/src/com/google/zxing/qrcode/encoder/QRCodeTestCase.java b/core/test/src/com/google/zxing/qrcode/encoder/QRCodeTestCase.java index 3e25d763..aa1295cf 100644 --- a/core/test/src/com/google/zxing/qrcode/encoder/QRCodeTestCase.java +++ b/core/test/src/com/google/zxing/qrcode/encoder/QRCodeTestCase.java @@ -83,55 +83,55 @@ public final class QRCodeTestCase extends TestCase { { QRCode qrCode = new QRCode(); String expected = - "<<\n" + - " mode: null\n" + - " ecLevel: null\n" + - " version: -1\n" + - " matrixWidth: -1\n" + - " maskPattern: -1\n" + - " numTotalBytes: -1\n" + - " numDataBytes: -1\n" + - " numECBytes: -1\n" + - " numRSBlocks: -1\n" + - " matrix: null\n" + - ">>\n"; + "<<\n" + + " mode: null\n" + + " ecLevel: null\n" + + " version: -1\n" + + " matrixWidth: -1\n" + + " maskPattern: -1\n" + + " numTotalBytes: -1\n" + + " numDataBytes: -1\n" + + " numECBytes: -1\n" + + " numRSBlocks: -1\n" + + " matrix: null\n" + + ">>\n"; assertEquals(expected, qrCode.toString()); } { String expected = - "<<\n" + - " mode: BYTE\n" + - " ecLevel: H\n" + - " version: 1\n" + - " matrixWidth: 21\n" + - " maskPattern: 3\n" + - " numTotalBytes: 26\n" + - " numDataBytes: 9\n" + - " numECBytes: 17\n" + - " numRSBlocks: 1\n" + - " matrix:\n" + - " 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0\n" + - " 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1\n" + - " 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0\n" + - " 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1\n" + - " 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0\n" + - " 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1\n" + - " 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0\n" + - " 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1\n" + - " 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0\n" + - " 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1\n" + - " 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0\n" + - " 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1\n" + - " 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0\n" + - " 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1\n" + - " 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0\n" + - " 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1\n" + - " 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0\n" + - " 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1\n" + - " 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0\n" + - " 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1\n" + - " 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0\n" + - ">>\n"; + "<<\n" + + " mode: BYTE\n" + + " ecLevel: H\n" + + " version: 1\n" + + " matrixWidth: 21\n" + + " maskPattern: 3\n" + + " numTotalBytes: 26\n" + + " numDataBytes: 9\n" + + " numECBytes: 17\n" + + " numRSBlocks: 1\n" + + " matrix:\n" + + " 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0\n" + + " 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1\n" + + " 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0\n" + + " 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1\n" + + " 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0\n" + + " 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1\n" + + " 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0\n" + + " 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1\n" + + " 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0\n" + + " 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1\n" + + " 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0\n" + + " 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1\n" + + " 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0\n" + + " 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1\n" + + " 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0\n" + + " 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1\n" + + " 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0\n" + + " 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1\n" + + " 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0\n" + + " 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1\n" + + " 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0\n" + + ">>\n"; QRCode qrCode = new QRCode(); qrCode.setMode(Mode.BYTE); qrCode.setECLevel(ErrorCorrectionLevel.H); diff --git a/jruby/lib/zxing.rb b/jruby/lib/zxing.rb index 506161da..09a6a19e 100644 --- a/jruby/lib/zxing.rb +++ b/jruby/lib/zxing.rb @@ -1,7 +1,7 @@ raise "ZXing requires JRuby" unless defined?(JRuby) -require File.expand_path( File.dirname(__FILE__) + '/core.jar' ) # ZXing core classes -require File.expand_path( File.dirname(__FILE__) + '/javase.jar' ) # ZXing JavaSE classes +require File.expand_path( File.dirname(__FILE__) + '/core.jar' ) # ZXing core classes +require File.expand_path( File.dirname(__FILE__) + '/javase.jar' ) # ZXing JavaSE classes require 'uri' diff --git a/zxing.appspot.com/generator/src/com/google/zxing/web/generator/Generator.gwt.xml b/zxing.appspot.com/generator/src/com/google/zxing/web/generator/Generator.gwt.xml index ddebe29d..145cedbb 100644 --- a/zxing.appspot.com/generator/src/com/google/zxing/web/generator/Generator.gwt.xml +++ b/zxing.appspot.com/generator/src/com/google/zxing/web/generator/Generator.gwt.xml @@ -1,21 +1,16 @@ - - - - -