More test cases from Enrique G. S.
git-svn-id: https://zxing.googlecode.com/svn/trunk@145 59b500cc-1b3d-0410-9834-0bbf25fbcc57
BIN
core/test/data/blackbox/upc2/1.JPG
Normal file
After Width: | Height: | Size: 150 KiB |
1
core/test/data/blackbox/upc2/1.txt
Normal file
|
@ -0,0 +1 @@
|
|||
8413000065504
|
BIN
core/test/data/blackbox/upc2/10.JPG
Normal file
After Width: | Height: | Size: 88 KiB |
1
core/test/data/blackbox/upc2/10.txt
Normal file
|
@ -0,0 +1 @@
|
|||
8480010001136
|
BIN
core/test/data/blackbox/upc2/11.JPG
Normal file
After Width: | Height: | Size: 92 KiB |
1
core/test/data/blackbox/upc2/11.txt
Normal file
|
@ -0,0 +1 @@
|
|||
061869053712
|
BIN
core/test/data/blackbox/upc2/12.JPG
Normal file
After Width: | Height: | Size: 83 KiB |
1
core/test/data/blackbox/upc2/12.txt
Normal file
|
@ -0,0 +1 @@
|
|||
5201815331227
|
BIN
core/test/data/blackbox/upc2/13.JPG
Normal file
After Width: | Height: | Size: 87 KiB |
1
core/test/data/blackbox/upc2/13.txt
Normal file
|
@ -0,0 +1 @@
|
|||
8413600298517
|
BIN
core/test/data/blackbox/upc2/14.JPG
Normal file
After Width: | Height: | Size: 86 KiB |
1
core/test/data/blackbox/upc2/14.txt
Normal file
|
@ -0,0 +1 @@
|
|||
3560070169443
|
BIN
core/test/data/blackbox/upc2/15.JPG
Normal file
After Width: | Height: | Size: 90 KiB |
1
core/test/data/blackbox/upc2/15.txt
Normal file
|
@ -0,0 +1 @@
|
|||
4045787034318
|
BIN
core/test/data/blackbox/upc2/16.JPG
Normal file
After Width: | Height: | Size: 94 KiB |
1
core/test/data/blackbox/upc2/16.txt
Normal file
|
@ -0,0 +1 @@
|
|||
045496442736
|
BIN
core/test/data/blackbox/upc2/17.JPG
Normal file
After Width: | Height: | Size: 86 KiB |
1
core/test/data/blackbox/upc2/17.txt
Normal file
|
@ -0,0 +1 @@
|
|||
619659023935
|
BIN
core/test/data/blackbox/upc2/18.JPG
Normal file
After Width: | Height: | Size: 88 KiB |
1
core/test/data/blackbox/upc2/18.txt
Normal file
|
@ -0,0 +1 @@
|
|||
3086126100326
|
BIN
core/test/data/blackbox/upc2/19.JPG
Normal file
After Width: | Height: | Size: 145 KiB |
1
core/test/data/blackbox/upc2/19.txt
Normal file
|
@ -0,0 +1 @@
|
|||
4820024790635
|
BIN
core/test/data/blackbox/upc2/2.JPG
Normal file
After Width: | Height: | Size: 149 KiB |
1
core/test/data/blackbox/upc2/2.txt
Normal file
|
@ -0,0 +1 @@
|
|||
8480010092271
|
BIN
core/test/data/blackbox/upc2/20.JPG
Normal file
After Width: | Height: | Size: 149 KiB |
1
core/test/data/blackbox/upc2/20.txt
Normal file
|
@ -0,0 +1 @@
|
|||
4000539017100
|
BIN
core/test/data/blackbox/upc2/21.JPG
Normal file
After Width: | Height: | Size: 156 KiB |
1
core/test/data/blackbox/upc2/21.txt
Normal file
|
@ -0,0 +1 @@
|
|||
7622200008018
|
BIN
core/test/data/blackbox/upc2/22.JPG
Normal file
After Width: | Height: | Size: 140 KiB |
1
core/test/data/blackbox/upc2/22.txt
Normal file
|
@ -0,0 +1 @@
|
|||
5603667020517
|
BIN
core/test/data/blackbox/upc2/23.JPG
Normal file
After Width: | Height: | Size: 150 KiB |
1
core/test/data/blackbox/upc2/23.txt
Normal file
|
@ -0,0 +1 @@
|
|||
7622400791949
|
BIN
core/test/data/blackbox/upc2/24.JPG
Normal file
After Width: | Height: | Size: 150 KiB |
1
core/test/data/blackbox/upc2/24.txt
Normal file
|
@ -0,0 +1 @@
|
|||
5709262942503
|
BIN
core/test/data/blackbox/upc2/25.JPG
Normal file
After Width: | Height: | Size: 152 KiB |
1
core/test/data/blackbox/upc2/25.txt
Normal file
|
@ -0,0 +1 @@
|
|||
9780140013993
|
BIN
core/test/data/blackbox/upc2/26.JPG
Normal file
After Width: | Height: | Size: 152 KiB |
1
core/test/data/blackbox/upc2/26.txt
Normal file
|
@ -0,0 +1 @@
|
|||
4901780188352
|
BIN
core/test/data/blackbox/upc2/27.JPG
Normal file
After Width: | Height: | Size: 160 KiB |
1
core/test/data/blackbox/upc2/27.txt
Normal file
|
@ -0,0 +1 @@
|
|||
606949762520
|
BIN
core/test/data/blackbox/upc2/28.JPG
Normal file
After Width: | Height: | Size: 163 KiB |
1
core/test/data/blackbox/upc2/28.txt
Normal file
|
@ -0,0 +1 @@
|
|||
9771699057002
|
BIN
core/test/data/blackbox/upc2/29.JPG
Normal file
After Width: | Height: | Size: 160 KiB |
1
core/test/data/blackbox/upc2/29.txt
Normal file
|
@ -0,0 +1 @@
|
|||
4007817327098
|
BIN
core/test/data/blackbox/upc2/3.JPG
Normal file
After Width: | Height: | Size: 152 KiB |
1
core/test/data/blackbox/upc2/3.txt
Normal file
|
@ -0,0 +1 @@
|
|||
8480000823274
|
BIN
core/test/data/blackbox/upc2/30.JPG
Normal file
After Width: | Height: | Size: 142 KiB |
1
core/test/data/blackbox/upc2/30.txt
Normal file
|
@ -0,0 +1 @@
|
|||
5025121072311
|
BIN
core/test/data/blackbox/upc2/4.JPG
Normal file
After Width: | Height: | Size: 159 KiB |
1
core/test/data/blackbox/upc2/4.txt
Normal file
|
@ -0,0 +1 @@
|
|||
5449000039231
|
BIN
core/test/data/blackbox/upc2/5.JPG
Normal file
After Width: | Height: | Size: 152 KiB |
1
core/test/data/blackbox/upc2/5.txt
Normal file
|
@ -0,0 +1 @@
|
|||
8410054010412
|
BIN
core/test/data/blackbox/upc2/6.JPG
Normal file
After Width: | Height: | Size: 147 KiB |
1
core/test/data/blackbox/upc2/6.txt
Normal file
|
@ -0,0 +1 @@
|
|||
8480010045062
|
BIN
core/test/data/blackbox/upc2/7.JPG
Normal file
After Width: | Height: | Size: 90 KiB |
1
core/test/data/blackbox/upc2/7.txt
Normal file
|
@ -0,0 +1 @@
|
|||
9788430532674
|
BIN
core/test/data/blackbox/upc2/8.JPG
Normal file
After Width: | Height: | Size: 89 KiB |
1
core/test/data/blackbox/upc2/8.txt
Normal file
|
@ -0,0 +1 @@
|
|||
8480017507990
|
BIN
core/test/data/blackbox/upc2/9.JPG
Normal file
After Width: | Height: | Size: 88 KiB |
1
core/test/data/blackbox/upc2/9.txt
Normal file
|
@ -0,0 +1 @@
|
|||
3166298099809
|
1
core/test/data/blackbox/upc2/README
Normal file
|
@ -0,0 +1 @@
|
|||
Thanks to Enrique G-S for contributing these test images.
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright 2008 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;
|
||||
|
||||
import com.google.zxing.common.AbstractBlackBoxTestCase;
|
||||
import com.google.zxing.upc.UPCReader;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* @author srowen@google.com (Sean Owen)
|
||||
*/
|
||||
public final class UPCReaderBlackBox2TestCase extends AbstractBlackBoxTestCase {
|
||||
|
||||
public UPCReaderBlackBox2TestCase() {
|
||||
super(new File("test/data/blackbox/upc2"), new UPCReader(), 0.5);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,95 +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.qrcode;
|
||||
|
||||
import com.google.zxing.ReaderException;
|
||||
import com.google.zxing.Result;
|
||||
import com.google.zxing.MonochromeBitmapSource;
|
||||
import com.google.zxing.Reader;
|
||||
import com.google.zxing.client.j2se.BufferedImageMonochromeBitmapSource;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
/**
|
||||
* @author srowen@google.com (Sean Owen)
|
||||
*/
|
||||
public final class QRCodeReaderTestCase extends TestCase {
|
||||
|
||||
public void testDecode() throws Exception {
|
||||
doTestURI("http://writerresponsetheory.org/wordpress/wp-content/uploads/qrcode_01.png",
|
||||
"When we at WRT talk about \\\"text,\\\" we are generally talking about a particular kind of readable " +
|
||||
"information encoding - and readable is a complex proposition. Text may be stylized in a way we are " +
|
||||
"unfamiliar with, as in blackletter - it may be interspersed with some markup we don\\'t understand, " +
|
||||
"such as HTML - it may be be a substitution system we aren\\'t familiar with, such as braille or " +
|
||||
"morse code - or it may be a system that, while technically human-readable, isn\\'t particularly " +
|
||||
"optimized for reading by humans, as with barcodes (although barcodes can be read).");
|
||||
doTestURI("http://writerresponsetheory.org/query/poe/qrcode%20outputs/qrcodegen-examples/chunk-from-128-bug-head/" +
|
||||
"encodes-by-nfggames/qr-chunk-from-128-bughead-ground.png",
|
||||
"LANDBYASCARC PERCEPTIBLEC EEK,OOZI GITSWAYTHROU AWILDERNESSOFBESUPPOSED,I " +
|
||||
"CANT,ORATL ASTDWARFISH.NO REESOFANYM NITUDEARETOBESOMEMISERA EFRAMEBUIL I GS,TENANTED, U " +
|
||||
"INGSUMMER THEFUGITIVE;BUTTHEWHO ISLAND,WI H EXCEPTIONOFT W STERNPOI ,ANDALINEOFLLIAMLEGR " +
|
||||
".HEWASOF N ENTHUGUENOTF Y ANDHADON BEENWEALTHTIONCONSE ENTUPONH SD STERS,HELEFTNE " +
|
||||
"LE NS,THEC OFHISFOREOUTHCARO A.THISISLA AVERYSINGULARO TCONSISTSO " +
|
||||
"ITTLEELSEDSAQUART FAMILE. TI PARATEDFROMTHEMA AN BYASCAR YPERCEPTERESORT " +
|
||||
"MARSH EN EVEGETATION,ASMIGH SU POSED, CANT,ORATREMITY, " +
|
||||
"ORT OULTRIESTANDS,ANDWHEREARESOM MIS FRAMEBUIFEVER,MAYBE " +
|
||||
"INDEED, TO;BUTT EISLAND,WITNYYEARSAGO,IC ACTED " +
|
||||
"LLIAM AND.HEWASOFANNESHADREDUCEDHIM OWA " +
|
||||
"IONC NSEQUENTUPONHISDSIDENCEATSULLIVA \\'S HC ROLINA.THISISLANOUTTHR " +
|
||||
"LESLON . THATN OINTE U RTEROF E.ITISTHROU ERNE DSANDSLI ,AFAVOR " +
|
||||
"TOFT HEN.T");
|
||||
doTestURI("http://www.malcolmhall.com/wp-content/uploads/2006/07/200607260214.jpg",
|
||||
"http://www.malcolmhall.com");
|
||||
doTestURI("http://www.qrcodeblog.com/qr/0609/060902_qr_kawasaki_st02.jpg",
|
||||
"http://wwws.keihin.ktr.mlit.go.jp/keitai/");
|
||||
doTestURI("http://mobile.kaywa.com/files/images/2007/4/480/mob181_1175524511.jpg",
|
||||
"2021200000");
|
||||
doTestURI("http://www.smoothplanet.com/files/images/2007/2/mob281_1170754866.jpg",
|
||||
"http://d.kaywa.com/20207100");
|
||||
doTestURI("http://www.mobileviews.com/blog/wp-content/uploads/2006/11/livebarcode.gif",
|
||||
"BIZCARD:N:Todd;X:Ogasawara;T:Tech Geek;C:MobileViews.com;A:MobileTown USA;E:editor@mobileviews.com;;");
|
||||
doTestURI("http://staticrooster.com/tshirts/qr_sm.gif",
|
||||
"http://staticrooster.com");
|
||||
doTestURI("http://www.ihaveanidea.org/blogs/uploads/i/interactive/270.png",
|
||||
"Morden");
|
||||
doTestURI("http://www.google.co.jp/mobile/images/qrcode_mobile.gif",
|
||||
"Google \u30e2\u30d0\u30a4\u30eb\r\nhttp://google.jp");
|
||||
}
|
||||
|
||||
private static void doTestURI(final String uriString, final String expected)
|
||||
throws URISyntaxException, IOException, ReaderException {
|
||||
URI uri = new URI(uriString);
|
||||
InputStream is = uri.toURL().openStream();
|
||||
try {
|
||||
BufferedImage image = ImageIO.read(is);
|
||||
MonochromeBitmapSource source = new BufferedImageMonochromeBitmapSource(image);
|
||||
Reader reader = new QRCodeReader();
|
||||
Result result = reader.decode(source);
|
||||
assertEquals(expected, result.getText());
|
||||
} finally {
|
||||
is.close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|