mirror of
https://github.com/zxing/zxing.git
synced 2024-11-10 13:04:05 -08:00
Finally actually fix the Code-128 bug and add tests
git-svn-id: https://zxing.googlecode.com/svn/trunk@588 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
78af16ca34
commit
6db50e0b79
|
@ -268,9 +268,6 @@ public final class Code128Reader extends AbstractOneDReader {
|
|||
|
||||
while (!done) {
|
||||
|
||||
// Remember whether the last code was printable or not (excluding CODE_STOP)
|
||||
lastCharacterWasPrintable = true;
|
||||
|
||||
boolean unshift = isNextShifted;
|
||||
isNextShifted = false;
|
||||
|
||||
|
@ -280,6 +277,11 @@ public final class Code128Reader extends AbstractOneDReader {
|
|||
// Decode another code from image
|
||||
code = decodeCode(row, counters, nextStart);
|
||||
|
||||
// Remember whether the last code was printable or not (excluding CODE_STOP)
|
||||
if (code != CODE_STOP) {
|
||||
lastCharacterWasPrintable = true;
|
||||
}
|
||||
|
||||
// Add to checksum computation (if not CODE_STOP of course)
|
||||
if (code != CODE_STOP) {
|
||||
multiplier++;
|
||||
|
|
BIN
core/test/data/blackbox/code128-3/1.png
Normal file
BIN
core/test/data/blackbox/code128-3/1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.8 KiB |
1
core/test/data/blackbox/code128-3/1.txt
Normal file
1
core/test/data/blackbox/code128-3/1.txt
Normal file
|
@ -0,0 +1 @@
|
|||
10064908
|
BIN
core/test/data/blackbox/code128-3/2.png
Normal file
BIN
core/test/data/blackbox/code128-3/2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6 KiB |
1
core/test/data/blackbox/code128-3/2.txt
Normal file
1
core/test/data/blackbox/code128-3/2.txt
Normal file
|
@ -0,0 +1 @@
|
|||
10068408
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* 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;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* @author srowen@google.com (Sean Owen)
|
||||
*/
|
||||
public final class Code128BlackBox3TestCase extends AbstractBlackBoxTestCase {
|
||||
|
||||
public Code128BlackBox3TestCase() {
|
||||
super(new File("test/data/blackbox/code128-3"), new MultiFormatReader(), BarcodeFormat.CODE_128);
|
||||
addTest(2, 2, 0.0f);
|
||||
addTest(2, 2, 180.0f);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue