From: Nick Burch Date: Mon, 3 May 2010 17:18:35 +0000 (+0000) Subject: Enable the tests for bug #49139, now that we have a sample test file to go with it X-Git-Tag: REL_3_7_BETA1~83 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=311e03f1e7a5532c10dbc7f7cfe998203c70c12b;p=poi.git Enable the tests for bug #49139, now that we have a sample test file to go with it git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@940519 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/testcases/org/apache/poi/poifs/filesystem/TestPOIFSFileSystem.java b/src/testcases/org/apache/poi/poifs/filesystem/TestPOIFSFileSystem.java index 46e47ca423..5bb740881a 100644 --- a/src/testcases/org/apache/poi/poifs/filesystem/TestPOIFSFileSystem.java +++ b/src/testcases/org/apache/poi/poifs/filesystem/TestPOIFSFileSystem.java @@ -179,8 +179,9 @@ public final class TestPOIFSFileSystem extends TestCase { * use 4k blocks. Check that we can open these. * DISABLED until we get a sample 4k block file that's under 22mb... */ - public void DISABLEDtest4KBlocks() throws Exception { - InputStream inp = new FileInputStream(new File("/home/nick/Downloads/IP-ConvertImage-01.zvi")); + public void test4KBlocks() throws Exception { + POIDataSamples _samples = POIDataSamples.getPOIFSInstance(); + InputStream inp = _samples.openResourceAsStream("BlockSize4096.zvi"); // First up, check that we can process the header properly HeaderBlockReader header_block_reader = new HeaderBlockReader(inp); @@ -189,7 +190,7 @@ public final class TestPOIFSFileSystem extends TestCase { // Check the fat info looks sane assertEquals(109, header_block_reader.getBATArray().length); - assertTrue(header_block_reader.getBATCount() > 5); + assertTrue(header_block_reader.getBATCount() > 0); assertEquals(0, header_block_reader.getXBATCount()); // Now check we can get the basic fat @@ -198,8 +199,15 @@ public final class TestPOIFSFileSystem extends TestCase { // Now try and open properly POIFSFileSystem fs = new POIFSFileSystem( - new FileInputStream(new File("/home/nick/Downloads/IP-ConvertImage-01.zvi")) + _samples.openResourceAsStream("BlockSize4096.zvi") ); + assertTrue(fs.getRoot().getEntryCount() > 3); + + // Finally, check we can do a similar 512byte one too + fs = new POIFSFileSystem( + _samples.openResourceAsStream("BlockSize512.zvi") + ); + assertTrue(fs.getRoot().getEntryCount() > 3); } private static InputStream openSampleStream(String sampleFileName) { diff --git a/test-data/poifs/BlockSize4096.zvi b/test-data/poifs/BlockSize4096.zvi new file mode 100755 index 0000000000..6379a042ee Binary files /dev/null and b/test-data/poifs/BlockSize4096.zvi differ diff --git a/test-data/poifs/BlockSize512.zvi b/test-data/poifs/BlockSize512.zvi new file mode 100644 index 0000000000..3a6be2f8d7 Binary files /dev/null and b/test-data/poifs/BlockSize512.zvi differ