mirror of
https://github.com/zxing/zxing.git
synced 2024-11-13 14:34:08 -08:00
Small tweaks on this test too
git-svn-id: https://zxing.googlecode.com/svn/trunk@266 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
1b36bc820e
commit
fd1620e753
|
@ -1,47 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2007 Google Inc.
|
|
||||||
*
|
|
||||||
* 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.datamatrix.detector;
|
|
||||||
|
|
||||||
import com.google.zxing.ResultPoint;
|
|
||||||
import com.google.zxing.common.BitMatrix;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>Encapsulates the result of detecting a barcode in an image. This includes the raw
|
|
||||||
* matrix of black/white pixels corresponding to the barcode, and possibly points of interest
|
|
||||||
* in the image, like the location of finder patterns or corners of the barcode in the image.</p>
|
|
||||||
*
|
|
||||||
* @author srowen@google.com (Sean Owen)
|
|
||||||
*/
|
|
||||||
public final class DetectorResult {
|
|
||||||
|
|
||||||
private final BitMatrix bits;
|
|
||||||
private final ResultPoint[] points;
|
|
||||||
|
|
||||||
DetectorResult(BitMatrix bits, ResultPoint[] points) {
|
|
||||||
this.bits = bits;
|
|
||||||
this.points = points;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BitMatrix getBits() {
|
|
||||||
return bits;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResultPoint[] getPoints() {
|
|
||||||
return points;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -25,17 +25,11 @@ import com.google.zxing.ReaderException;
|
||||||
*/
|
*/
|
||||||
public final class DecodedBitStreamParserTestCase extends TestCase{
|
public final class DecodedBitStreamParserTestCase extends TestCase{
|
||||||
|
|
||||||
public void testAsciiStandardDecode() {
|
public void testAsciiStandardDecode() throws ReaderException {
|
||||||
// ASCII characters 0-127 are encoded as the value + 1
|
// ASCII characters 0-127 are encoded as the value + 1
|
||||||
byte[] bytes = new byte[]{(byte) ('a' + 1), (byte) ('b' + 1), (byte) ('c' + 1),
|
byte[] bytes = new byte[]{(byte) ('a' + 1), (byte) ('b' + 1), (byte) ('c' + 1),
|
||||||
(byte) ('A' + 1), (byte) ('B' + 1), (byte) ('C' + 1)};
|
(byte) ('A' + 1), (byte) ('B' + 1), (byte) ('C' + 1)};
|
||||||
String decodedString = "";
|
String decodedString = DecodedBitStreamParser.decode(bytes);
|
||||||
try {
|
|
||||||
decodedString = DecodedBitStreamParser.decode(bytes);
|
|
||||||
} catch (ReaderException readerException) {
|
|
||||||
// TODO(bbrown): Throw this to junit?
|
|
||||||
}
|
|
||||||
|
|
||||||
assertEquals("abcABC", decodedString);
|
assertEquals("abcABC", decodedString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,9 +37,7 @@ public final class DecodedBitStreamParserTestCase extends TestCase{
|
||||||
// ASCII double digit (00 - 99) Numeric Value + 130
|
// ASCII double digit (00 - 99) Numeric Value + 130
|
||||||
byte[] bytes = new byte[]{(byte) (00 + 130), (byte) (01 + 130),
|
byte[] bytes = new byte[]{(byte) (00 + 130), (byte) (01 + 130),
|
||||||
(byte) (98 + 130), (byte) (99 + 130)};
|
(byte) (98 + 130), (byte) (99 + 130)};
|
||||||
String decodedString = "";
|
String decodedString = DecodedBitStreamParser.decode(bytes);
|
||||||
decodedString = DecodedBitStreamParser.decode(bytes);
|
|
||||||
|
|
||||||
assertEquals("00019899", decodedString);
|
assertEquals("00019899", decodedString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue