diff --git a/core/src/com/google/zxing/oned/Code128Reader.java b/core/src/com/google/zxing/oned/Code128Reader.java index 96212b76e..969a341d9 100644 --- a/core/src/com/google/zxing/oned/Code128Reader.java +++ b/core/src/com/google/zxing/oned/Code128Reader.java @@ -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++; diff --git a/core/test/data/blackbox/code128-3/1.png b/core/test/data/blackbox/code128-3/1.png new file mode 100644 index 000000000..0c9eb7a2c Binary files /dev/null and b/core/test/data/blackbox/code128-3/1.png differ diff --git a/core/test/data/blackbox/code128-3/1.txt b/core/test/data/blackbox/code128-3/1.txt new file mode 100644 index 000000000..f55057e19 --- /dev/null +++ b/core/test/data/blackbox/code128-3/1.txt @@ -0,0 +1 @@ +10064908 \ No newline at end of file diff --git a/core/test/data/blackbox/code128-3/2.png b/core/test/data/blackbox/code128-3/2.png new file mode 100644 index 000000000..fe87e26e5 Binary files /dev/null and b/core/test/data/blackbox/code128-3/2.png differ diff --git a/core/test/data/blackbox/code128-3/2.txt b/core/test/data/blackbox/code128-3/2.txt new file mode 100644 index 000000000..f2ea59dc1 --- /dev/null +++ b/core/test/data/blackbox/code128-3/2.txt @@ -0,0 +1 @@ +10068408 \ No newline at end of file diff --git a/core/test/src/com/google/zxing/oned/Code128BlackBox3TestCase.java b/core/test/src/com/google/zxing/oned/Code128BlackBox3TestCase.java new file mode 100644 index 000000000..190bd538b --- /dev/null +++ b/core/test/src/com/google/zxing/oned/Code128BlackBox3TestCase.java @@ -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); + } + +} \ No newline at end of file