]> source.dussan.org Git - poi.git/commitdiff
Enable the tests for bug #49139, now that we have a sample test file to go with it
authorNick Burch <nick@apache.org>
Mon, 3 May 2010 17:18:35 +0000 (17:18 +0000)
committerNick Burch <nick@apache.org>
Mon, 3 May 2010 17:18:35 +0000 (17:18 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@940519 13f79535-47bb-0310-9956-ffa450edef68

src/testcases/org/apache/poi/poifs/filesystem/TestPOIFSFileSystem.java
test-data/poifs/BlockSize4096.zvi [new file with mode: 0755]
test-data/poifs/BlockSize512.zvi [new file with mode: 0644]

index 46e47ca423378aec02884f926d6bdcec528fc1b7..5bb740881ac8a0eac84c71382fe936f240a24146 100644 (file)
@@ -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 (executable)
index 0000000..6379a04
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 (file)
index 0000000..3a6be2f
Binary files /dev/null and b/test-data/poifs/BlockSize512.zvi differ