X-Git-Url: http://git.rot13.org/?p=zxing.git;a=blobdiff_plain;f=core%2Ftest%2Fsrc%2Fcom%2Fgoogle%2Fzxing%2Foned%2Frss%2Fexpanded%2FRSSExpandedImage2binaryTestCase.java;h=6372fb8f69c93f8c564e947863920b3fc4ff80ed;hp=2b45c096047cec83fb8d47f580300e69f6fe1575;hb=e5d03a79a458340b69a57914a352f0a8841cdf69;hpb=a932cce57fabafd18a5db770f2c87afbd72e31b9 diff --git a/core/test/src/com/google/zxing/oned/rss/expanded/RSSExpandedImage2binaryTestCase.java b/core/test/src/com/google/zxing/oned/rss/expanded/RSSExpandedImage2binaryTestCase.java index 2b45c096..6372fb8f 100644 --- a/core/test/src/com/google/zxing/oned/rss/expanded/RSSExpandedImage2binaryTestCase.java +++ b/core/test/src/com/google/zxing/oned/rss/expanded/RSSExpandedImage2binaryTestCase.java @@ -33,21 +33,22 @@ import java.util.Vector; import javax.imageio.ImageIO; -import junit.framework.TestCase; - import com.google.zxing.BinaryBitmap; import com.google.zxing.NotFoundException; import com.google.zxing.client.j2se.BufferedImageLuminanceSource; import com.google.zxing.common.BitArray; import com.google.zxing.common.GlobalHistogramBinarizer; +import org.junit.Assert; +import org.junit.Test; /** * @author Pablo Orduña, University of Deusto (pablo.orduna@deusto.es) * @author Eduardo Castillejo, University of Deusto (eduardo.castillejo@deusto.es) */ -public final class RSSExpandedImage2binaryTestCase extends TestCase { +public final class RSSExpandedImage2binaryTestCase extends Assert { - public void testDecodeRow2binary_1() throws Exception{ + @Test + public void testDecodeRow2binary_1() throws Exception { // (11)100224(17)110224(3102)000100 String path = "test/data/blackbox/rssexpanded-1/1.jpg"; String expected = " ...X...X .X....X. .XX...X. X..X...X ...XX.X. ..X.X... ..X.X..X ...X..X. X.X....X .X....X. .....X.. X...X..."; @@ -55,7 +56,8 @@ public final class RSSExpandedImage2binaryTestCase extends TestCase { assertCorrectImage2binary(path, expected); } - public void testDecodeRow2binary_2() throws Exception{ + @Test + public void testDecodeRow2binary_2() throws Exception { // (01)90012345678908(3103)001750 String path = "test/data/blackbox/rssexpanded-1/2.jpg"; String expected = " ..X..... ......X. .XXX.X.X .X...XX. XXXXX.XX XX.X.... .XX.XX.X .XX."; @@ -64,7 +66,8 @@ public final class RSSExpandedImage2binaryTestCase extends TestCase { } - public void testDecodeRow2binary_3() throws Exception{ + @Test + public void testDecodeRow2binary_3() throws Exception { // (10)12A String path = "test/data/blackbox/rssexpanded-1/3.jpg"; String expected = " .......X ..XX..X. X.X....X .......X ...."; @@ -72,7 +75,8 @@ public final class RSSExpandedImage2binaryTestCase extends TestCase { assertCorrectImage2binary(path, expected); } - public void testDecodeRow2binary_4() throws Exception{ + @Test + public void testDecodeRow2binary_4() throws Exception { // (01)98898765432106(3202)012345(15)991231 String path = "test/data/blackbox/rssexpanded-1/4.jpg"; String expected = " ..XXXX.X XX.XXXX. .XXX.XX. XX..X... .XXXXX.. XX.X..X. ..XX..XX XX.X.XXX X..XX..X .X.XXXXX XXXX"; @@ -80,7 +84,8 @@ public final class RSSExpandedImage2binaryTestCase extends TestCase { assertCorrectImage2binary(path, expected); } - public void testDecodeRow2binary_5() throws Exception{ + @Test + public void testDecodeRow2binary_5() throws Exception { // (01)90614141000015(3202)000150 String path = "test/data/blackbox/rssexpanded-1/5.jpg"; String expected = " ..X.X... .XXXX.X. XX..XXXX ....XX.. X....... ....X... ....X..X .XX."; @@ -88,7 +93,8 @@ public final class RSSExpandedImage2binaryTestCase extends TestCase { assertCorrectImage2binary(path, expected); } - public void testDecodeRow2binary_10() throws Exception{ + @Test + public void testDecodeRow2binary_10() throws Exception { // (01)98898765432106(15)991231(3103)001750(10)12A(422)123(21)123456(423)0123456789012 String path = "test/data/blackbox/rssexpanded-1/10.png"; String expected = " .X.XX..X XX.XXXX. .XXX.XX. XX..X... .XXXXX.. XX.X..X. ..XX...X XX.X.... X.X.X.X. X.X..X.X .X....X. XX...X.. ...XX.X. .XXXXXX. .X..XX.. X.X.X... .X...... XXXX.... XX.XX... XXXXX.X. ...XXXXX .....X.X ...X.... X.XXX..X X.X.X... XX.XX..X .X..X..X .X.X.X.X X.XX...X .XX.XXX. XXX.X.XX ..X."; @@ -96,7 +102,8 @@ public final class RSSExpandedImage2binaryTestCase extends TestCase { assertCorrectImage2binary(path, expected); } - public void testDecodeRow2binary_11() throws Exception{ + @Test + public void testDecodeRow2binary_11() throws Exception { // (01)98898765432106(15)991231(3103)001750(10)12A(422)123(21)123456 String expected = " .X.XX..X XX.XXXX. .XXX.XX. XX..X... .XXXXX.. XX.X..X. ..XX...X XX.X.... X.X.X.X. X.X..X.X .X....X. XX...X.. ...XX.X. .XXXXXX. .X..XX.. X.X.X... .X...... XXXX.... XX.XX... XXXXX.X. ...XXXXX .....X.X ...X.... X.XXX..X X.X.X... ...."; String path = "test/data/blackbox/rssexpanded-1/11.png"; @@ -104,7 +111,8 @@ public final class RSSExpandedImage2binaryTestCase extends TestCase { assertCorrectImage2binary(path, expected); } - public void testDecodeRow2binary_12() throws Exception{ + @Test + public void testDecodeRow2binary_12() throws Exception { // (01)98898765432106(3103)001750 String expected = " ..X..XX. XXXX..XX X.XX.XX. .X....XX XXX..XX. X..X.... .XX.XX.X .XX."; @@ -113,7 +121,8 @@ public final class RSSExpandedImage2binaryTestCase extends TestCase { assertCorrectImage2binary(path, expected); } - public void testDecodeRow2binary_13() throws Exception{ + @Test + public void testDecodeRow2binary_13() throws Exception { // (01)90012345678908(3922)795 String expected = " ..XX..X. ........ .X..XXX. X.X.X... XX.XXXXX .XXXX.X. X.X.XXXX .X..X..X ......X."; @@ -122,7 +131,8 @@ public final class RSSExpandedImage2binaryTestCase extends TestCase { assertCorrectImage2binary(path, expected); } - public void testDecodeRow2binary_14() throws Exception{ + @Test + public void testDecodeRow2binary_14() throws Exception { // (01)90012345678908(3932)0401234 String expected = " ..XX.X.. ........ .X..XXX. X.X.X... XX.XXXXX .XXXX.X. X.....X. X.....X. X.X.X.XX .X...... X..."; @@ -131,7 +141,8 @@ public final class RSSExpandedImage2binaryTestCase extends TestCase { assertCorrectImage2binary(path, expected); } - public void testDecodeRow2binary_15() throws Exception{ + @Test + public void testDecodeRow2binary_15() throws Exception { // (01)90012345678908(3102)001750(11)100312 String expected = " ..XXX... ........ .X..XXX. X.X.X... XX.XXXXX .XXXX.X. ..XX...X .X.....X .XX..... XXXX.X.. XX.."; @@ -140,7 +151,8 @@ public final class RSSExpandedImage2binaryTestCase extends TestCase { assertCorrectImage2binary(path, expected); } - public void testDecodeRow2binary_16() throws Exception{ + @Test + public void testDecodeRow2binary_16() throws Exception { // (01)90012345678908(3202)001750(11)100312 String expected = " ..XXX..X ........ .X..XXX. X.X.X... XX.XXXXX .XXXX.X. ..XX...X .X.....X .XX..... XXXX.X.. XX.."; @@ -149,7 +161,8 @@ public final class RSSExpandedImage2binaryTestCase extends TestCase { assertCorrectImage2binary(path, expected); } - public void testDecodeRow2binary_17() throws Exception{ + @Test + public void testDecodeRow2binary_17() throws Exception { // (01)90012345678908(3102)001750(13)100312 String expected = " ..XXX.X. ........ .X..XXX. X.X.X... XX.XXXXX .XXXX.X. ..XX...X .X.....X .XX..... XXXX.X.. XX.."; @@ -158,7 +171,8 @@ public final class RSSExpandedImage2binaryTestCase extends TestCase { assertCorrectImage2binary(path, expected); } - public void testDecodeRow2binary_18() throws Exception{ + @Test + public void testDecodeRow2binary_18() throws Exception { // (01)90012345678908(3202)001750(13)100312 String expected = " ..XXX.XX ........ .X..XXX. X.X.X... XX.XXXXX .XXXX.X. ..XX...X .X.....X .XX..... XXXX.X.. XX.."; @@ -167,7 +181,8 @@ public final class RSSExpandedImage2binaryTestCase extends TestCase { assertCorrectImage2binary(path, expected); } - public void testDecodeRow2binary_19() throws Exception{ + @Test + public void testDecodeRow2binary_19() throws Exception { // (01)90012345678908(3102)001750(15)100312 String expected = " ..XXXX.. ........ .X..XXX. X.X.X... XX.XXXXX .XXXX.X. ..XX...X .X.....X .XX..... XXXX.X.. XX.."; @@ -176,7 +191,8 @@ public final class RSSExpandedImage2binaryTestCase extends TestCase { assertCorrectImage2binary(path, expected); } - public void testDecodeRow2binary_20() throws Exception{ + @Test + public void testDecodeRow2binary_20() throws Exception { // (01)90012345678908(3202)001750(15)100312 String expected = " ..XXXX.X ........ .X..XXX. X.X.X... XX.XXXXX .XXXX.X. ..XX...X .X.....X .XX..... XXXX.X.. XX.."; @@ -185,7 +201,8 @@ public final class RSSExpandedImage2binaryTestCase extends TestCase { assertCorrectImage2binary(path, expected); } - public void testDecodeRow2binary_21() throws Exception{ + @Test + public void testDecodeRow2binary_21() throws Exception { // (01)90012345678908(3102)001750(17)100312 String expected = " ..XXXXX. ........ .X..XXX. X.X.X... XX.XXXXX .XXXX.X. ..XX...X .X.....X .XX..... XXXX.X.. XX.."; @@ -194,7 +211,8 @@ public final class RSSExpandedImage2binaryTestCase extends TestCase { assertCorrectImage2binary(path, expected); } - public void testDecodeRow2binary_22() throws Exception{ + @Test + public void testDecodeRow2binary_22() throws Exception { // (01)90012345678908(3202)001750(17)100312 String expected = " ..XXXXXX ........ .X..XXX. X.X.X... XX.XXXXX .XXXX.X. ..XX...X .X.....X .XX..... XXXX.X.. XX.."; @@ -203,8 +221,7 @@ public final class RSSExpandedImage2binaryTestCase extends TestCase { assertCorrectImage2binary(path, expected); } - private static void assertCorrectImage2binary(String path, - String expected) throws IOException, NotFoundException { + private static void assertCorrectImage2binary(String path, String expected) throws IOException, NotFoundException { RSSExpandedReader rssExpandedReader = new RSSExpandedReader(); BufferedImage image = ImageIO.read(new File(path)); @@ -212,7 +229,7 @@ public final class RSSExpandedImage2binaryTestCase extends TestCase { int rowNumber = binaryMap.getHeight() / 2; BitArray row = binaryMap.getBlackRow(rowNumber, null); - Vector pairs = rssExpandedReader.decodeRow2pairs(rowNumber, row); + Vector pairs = rssExpandedReader.decodeRow2pairs(rowNumber, row); BitArray binary = BitArrayBuilder.buildBitArray(pairs); assertEquals(expected, binary.toString()); }