Skip to content
This repository has been archived by the owner on Mar 17, 2022. It is now read-only.

Commit

Permalink
Minor changes to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rmtheis committed Aug 2, 2015
1 parent 284b25c commit 9a47f11
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 12 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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());
Expand All @@ -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());
Expand All @@ -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());
Expand All @@ -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);

Expand All @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 9a47f11

Please sign in to comment.