]> source.dussan.org Git - poi.git/commitdiff
HWPF: test auto-saved document
authorMaxim Valyanskiy <maxcom@apache.org>
Wed, 7 Jul 2010 10:41:17 +0000 (10:41 +0000)
committerMaxim Valyanskiy <maxcom@apache.org>
Wed, 7 Jul 2010 10:41:17 +0000 (10:41 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@961342 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordExtractor.java
src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestPictures.java
test-data/document/rasp.doc [new file with mode: 0644]

index eabb16b7c83ca075cb56c0f5eabbaa3bea385f13..22eaf0ade470a641eeb0d300cff28ff8409914a4 100644 (file)
@@ -288,4 +288,14 @@ public final class TestWordExtractor extends TestCase {
         assertEquals(1, tp.length);
         assertEquals("The quick brown fox jumps over the lazy dog\r\n", tp[0]);
        }
+
+    public void testFastSaved() throws Exception {
+        extractor = new WordExtractor(
+                POIDataSamples.getDocumentInstance().openResourceAsStream("rasp.doc")
+        );
+
+        String text = extractor.getText();
+        assertTrue(text.contains("\u0425\u0425\u0425\u0425\u0425"));
+        assertTrue(text.contains("\u0423\u0423\u0423\u0423\u0423"));
+    }
 }
index 897ca86f1c3aeaf32d863fcd35e5acd581c366cb..05013b07fb4a801d370cdd79ad8ecc1447d4f151 100644 (file)
@@ -141,14 +141,20 @@ public final class TestPictures extends TestCase {
                HWPFDocument doc = HWPFTestDataSamples.openSampleFile("Bug44603.doc");
 
                List pics = doc.getPicturesTable().getAllPictures();
-               assertEquals(pics.size(), 2);
+               assertEquals(2, pics.size());
        }
 
         public void testPicturesInHeader() {
                 HWPFDocument doc = HWPFTestDataSamples.openSampleFile("header_image.doc");
 
                 List pics = doc.getPicturesTable().getAllPictures();
-                assertEquals(pics.size(), 2);
+                assertEquals(2, pics.size());
         }
 
+    public void testFastSaved() {
+            HWPFDocument doc = HWPFTestDataSamples.openSampleFile("rasp.doc");
+
+            doc.getPicturesTable().getAllPictures(); // just check that we do not throw Exception
+    }
+
 }
diff --git a/test-data/document/rasp.doc b/test-data/document/rasp.doc
new file mode 100644 (file)
index 0000000..df39b69
Binary files /dev/null and b/test-data/document/rasp.doc differ