Turned on ITF as a format you can request via hint. Also rejiggered the unit test...
[zxing.git] / core / test / src / com / google / zxing / oned / ITFBlackBox1TestCase.java
1 /*\r
2  * Copyright 2008 ZXing authors\r
3  *\r
4  * Licensed under the Apache License, Version 2.0 (the "License");\r
5  * you may not use this file except in compliance with the License.\r
6  * You may obtain a copy of the License at\r
7  *\r
8  *      http://www.apache.org/licenses/LICENSE-2.0\r
9  *\r
10  * Unless required by applicable law or agreed to in writing, software\r
11  * distributed under the License is distributed on an "AS IS" BASIS,\r
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
13  * See the License for the specific language governing permissions and\r
14  * limitations under the License.\r
15  */\r
16 \r
17 package com.google.zxing.oned;\r
18 \r
19 import com.google.zxing.BarcodeFormat;\r
20 import com.google.zxing.DecodeHintType;\r
21 import com.google.zxing.MultiFormatReader;\r
22 import com.google.zxing.common.AbstractBlackBoxTestCase;\r
23 \r
24 import java.io.File;\r
25 import java.util.Hashtable;\r
26 import java.util.Vector;\r
27 \r
28 /**\r
29  * @author kevin.osullivan@sita.aero\r
30  */\r
31 public final class ITFBlackBox1TestCase extends AbstractBlackBoxTestCase {\r
32 \r
33   public ITFBlackBox1TestCase() {\r
34     super(new File("test/data/blackbox/itf-1"), new MultiFormatReader(), BarcodeFormat.ITF);\r
35     addTest(9, 12, 0.0f);\r
36   }\r
37 \r
38   // TODO(dswitkin): This is only used for the mean time because ITF is not turned on by default.\r
39   // The other formats are included here to make sure we don't recognize an ITF barcode as something\r
40   // else. Unfortunately this list is fragile. The right thing to do is profile ITF for performance,\r
41   // and if it doesn't impose significant overhead, turn it on by default. Then this method can be\r
42   // removed completely.\r
43   @Override\r
44   protected Hashtable<DecodeHintType, Object> getHints() {\r
45     Hashtable<DecodeHintType, Object> hints = new Hashtable<DecodeHintType, Object>(3);\r
46     Vector<BarcodeFormat> vector = new Vector<BarcodeFormat>();\r
47     vector.addElement(BarcodeFormat.UPC_A);\r
48     vector.addElement(BarcodeFormat.UPC_E);\r
49     vector.addElement(BarcodeFormat.EAN_13);\r
50     vector.addElement(BarcodeFormat.EAN_8);\r
51     vector.addElement(BarcodeFormat.CODE_39);\r
52     vector.addElement(BarcodeFormat.CODE_128);\r
53     vector.addElement(BarcodeFormat.ITF);\r
54     vector.addElement(BarcodeFormat.QR_CODE);\r
55     hints.put(DecodeHintType.POSSIBLE_FORMATS, vector);\r
56     return hints;\r
57   }\r
58 \r
59 }\r