diff --git a/README.md b/README.md index 93df3b518..c7936739a 100644 --- a/README.md +++ b/README.md @@ -72,8 +72,8 @@ registered in a Maven central repository), it can be ## ProGuard If you're using ProGuard for code shrinking and obfuscation, add the following -to your app's ProGuard config to retain fields used for sharing data with native -code: +rules to your app's ProGuard config to retain fields used for sharing data with +native code: ```proguard # tess-two -keep class com.googlecode.leptonica.android.Box { diff --git a/tess-two-test/src/com/googlecode/leptonica/android/test/ReadFileTest.java b/tess-two-test/src/com/googlecode/leptonica/android/test/ReadFileTest.java index f1d6782df..805184f87 100644 --- a/tess-two-test/src/com/googlecode/leptonica/android/test/ReadFileTest.java +++ b/tess-two-test/src/com/googlecode/leptonica/android/test/ReadFileTest.java @@ -38,8 +38,17 @@ public class ReadFileTest extends TestCase { private static final String TAG = ReadFileTest.class.getSimpleName(); @SmallTest - public void testReadBitmap() { + public void testReadBitmap_1x1() { testReadBitmap(1, 1, Bitmap.Config.ARGB_8888); + } + + @SmallTest + public void testReadBitmap_100x100() { + testReadBitmap(100, 100, Bitmap.Config.ARGB_8888); + } + + @SmallTest + public void testReadBitmap_640x480() { testReadBitmap(640, 480, Bitmap.Config.ARGB_8888); } @@ -63,7 +72,10 @@ public void testReadFile_bmp() throws IOException { File file = File.createTempFile("testReadFile", ".bmp"); FileOutputStream fileStream = new FileOutputStream(file); Bitmap bmp = TestUtils.createTestBitmap(100, 100, Bitmap.Config.RGB_565); - bmp.compress(CompressFormat.PNG, 100, fileStream); + boolean compressed = bmp.compress(CompressFormat.PNG, 100, fileStream); + + assertTrue(compressed); + Pix pix = ReadFile.readFile(file); assertEquals(bmp.getWidth(), pix.getWidth()); @@ -83,7 +95,10 @@ public void testReadFile_jpg() throws IOException { File file = File.createTempFile("testReadFile", ".jpg"); FileOutputStream fileStream = new FileOutputStream(file); Bitmap bmp = TestUtils.createTestBitmap(100, 100, Bitmap.Config.RGB_565); - bmp.compress(CompressFormat.JPEG, 85, fileStream); + boolean compressed = bmp.compress(CompressFormat.JPEG, 85, fileStream); + + assertTrue(compressed); + Pix pix = ReadFile.readFile(file); assertEquals(bmp.getWidth(), pix.getWidth()); @@ -103,7 +118,10 @@ public void testReadFile_png() throws IOException { File file = File.createTempFile("testReadFile", ".png"); FileOutputStream fileStream = new FileOutputStream(file); Bitmap bmp = TestUtils.createTestBitmap(100, 100, Bitmap.Config.RGB_565); - bmp.compress(CompressFormat.PNG, 100, fileStream); + boolean compressed = bmp.compress(CompressFormat.PNG, 100, fileStream); + + assertTrue(compressed); + Pix pix = ReadFile.readFile(file); assertEquals(bmp.getWidth(), pix.getWidth()); @@ -122,7 +140,10 @@ public void testReadFile_png() throws IOException { public void testReadMem_jpg() throws IOException { ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); Bitmap bmp = TestUtils.createTestBitmap(100, 100, Bitmap.Config.RGB_565); - bmp.compress(CompressFormat.JPEG, 85, byteStream); + boolean compressed = bmp.compress(CompressFormat.JPEG, 85, byteStream); + + assertTrue(compressed); + byte[] encodedData = byteStream.toByteArray(); Pix pix = ReadFile.readMem(encodedData); @@ -143,7 +164,10 @@ public void testReadMem_jpg() throws IOException { public void testReadMem_png() throws IOException { ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); Bitmap bmp = TestUtils.createTestBitmap(100, 100, Bitmap.Config.RGB_565); - bmp.compress(CompressFormat.PNG, 100, byteStream); + boolean compressed = bmp.compress(CompressFormat.PNG, 100, byteStream); + + assertTrue(compressed); + byte[] encodedData = byteStream.toByteArray(); Pix pix = ReadFile.readMem(encodedData); diff --git a/tess-two-test/src/com/googlecode/leptonica/android/test/WriteFileTest.java b/tess-two-test/src/com/googlecode/leptonica/android/test/WriteFileTest.java index 6dd6b47bd..66b861e07 100644 --- a/tess-two-test/src/com/googlecode/leptonica/android/test/WriteFileTest.java +++ b/tess-two-test/src/com/googlecode/leptonica/android/test/WriteFileTest.java @@ -29,9 +29,17 @@ public class WriteFileTest extends TestCase { @SmallTest - public void testWriteBitmap() { + public void testWriteBitmap_1x1() { testWriteBitmap(1, 1); + } + + @SmallTest + public void testWriteBitmap_100x100() { testWriteBitmap(100, 100); + } + + @SmallTest + public void testWriteBitmap_640x480() { testWriteBitmap(640, 480); } @@ -50,9 +58,17 @@ private void testWriteBitmap(int width, int height) { } @SmallTest - public void testWriteBytes8() { + public void testWriteBytes8_1x1() { testWriteBytes8(1, 1); + } + + @SmallTest + public void testWriteBytes8_100x100() { testWriteBytes8(100, 100); + } + + @SmallTest + public void testWriteBytes8_640x480() { testWriteBytes8(640, 480); } diff --git a/tess-two-test/src/com/googlecode/tesseract/android/test/TessBaseAPITest.java b/tess-two-test/src/com/googlecode/tesseract/android/test/TessBaseAPITest.java index 2445e6dcf..b8f1ac5c2 100644 --- a/tess-two-test/src/com/googlecode/tesseract/android/test/TessBaseAPITest.java +++ b/tess-two-test/src/com/googlecode/tesseract/android/test/TessBaseAPITest.java @@ -46,8 +46,6 @@ public class TessBaseAPITest extends TestCase { private static final String TESSBASE_PATH = "/mnt/sdcard/tesseract/"; private static final String DEFAULT_LANGUAGE = "eng"; private static final String TESSDATA_PATH = TESSBASE_PATH + "tessdata/"; - private static final String EXPECTED_FILE = - TESSDATA_PATH + DEFAULT_LANGUAGE + ".traineddata"; private static final String[] EXPECTED_CUBE_DATA_FILES_ENG = { "eng.cube.bigrams", "eng.cube.fold",