"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "core/src/test/java/com/google/zxing/oned/UPCEWriterTestCase.java" between
zxing-zxing-3.4.0.tar.gz and zxing-zxing-3.4.1.tar.gz

About: ZXing ("zebra crossing") is a multi-format 1D/2D barcode image processing library implemented in Java, with ports to other languages.

UPCEWriterTestCase.java  (zxing-zxing-3.4.0):UPCEWriterTestCase.java  (zxing-zxing-3.4.1)
skipping to change at line 20 skipping to change at line 20
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.google.zxing.oned; package com.google.zxing.oned;
import com.google.zxing.BarcodeFormat; import com.google.zxing.BarcodeFormat;
import com.google.zxing.WriterException;
import com.google.zxing.common.BitMatrix; import com.google.zxing.common.BitMatrix;
import com.google.zxing.common.BitMatrixTestCase; import com.google.zxing.common.BitMatrixTestCase;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
/** /**
* Tests {@link UPCEWriter}. * Tests {@link UPCEWriter}.
*/ */
public final class UPCEWriterTestCase extends Assert { public final class UPCEWriterTestCase extends Assert {
@Test @Test
public void testEncode() throws WriterException { public void testEncode() {
doTest("05096893", doTest("05096893",
"00000000000101011100101001110001011010111101101110010111010101000000 00000"); "00000000000101011100101001110001011010111101101110010111010101000000 00000");
} }
@Test @Test
public void testEncodeSystem1() throws WriterException { public void testEncodeSystem1() {
doTest("12345670", doTest("12345670",
"00000000000101001001101111010100011011100100001010010001010101000000 00000"); "00000000000101001001101111010100011011100100001010010001010101000000 00000");
} }
@Test @Test
public void testAddChecksumAndEncode() throws WriterException { public void testAddChecksumAndEncode() {
doTest("0509689", doTest("0509689",
"00000000000101011100101001110001011010111101101110010111010101000000 00000"); "00000000000101011100101001110001011010111101101110010111010101000000 00000");
} }
private static void doTest(String content, String encoding) throws WriterExcep tion { private static void doTest(String content, String encoding) {
BitMatrix result = new UPCEWriter().encode(content, BarcodeFormat.UPC_E, enc oding.length(), 0); BitMatrix result = new UPCEWriter().encode(content, BarcodeFormat.UPC_E, enc oding.length(), 0);
assertEquals(encoding, BitMatrixTestCase.matrixToString(result)); assertEquals(encoding, BitMatrixTestCase.matrixToString(result));
} }
@Test(expected = IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)
public void testEncodeIllegalCharacters() throws WriterException { public void testEncodeIllegalCharacters() {
new UPCEWriter().encode("05096abc", BarcodeFormat.UPC_E, 0, 0); new UPCEWriter().encode("05096abc", BarcodeFormat.UPC_E, 0, 0);
} }
} }
 End of changes. 6 change blocks. 
6 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)