From d7c62aae580de7eea4c485094ac6e9af88d0c261 Mon Sep 17 00:00:00 2001 From: Maxim Valyanskiy Date: Wed, 7 Jul 2010 10:41:17 +0000 Subject: [PATCH] HWPF: test auto-saved document git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@961342 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/hwpf/extractor/TestWordExtractor.java | 10 ++++++++++ .../apache/poi/hwpf/usermodel/TestPictures.java | 10 ++++++++-- test-data/document/rasp.doc | Bin 0 -> 38912 bytes 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 test-data/document/rasp.doc diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordExtractor.java b/src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordExtractor.java index eabb16b7c8..22eaf0ade4 100644 --- a/src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordExtractor.java +++ b/src/scratchpad/testcases/org/apache/poi/hwpf/extractor/TestWordExtractor.java @@ -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")); + } } diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestPictures.java b/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestPictures.java index 897ca86f1c..05013b07fb 100644 --- a/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestPictures.java +++ b/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestPictures.java @@ -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 index 0000000000000000000000000000000000000000..df39b696b0337183457fdce9991a4483b0bce9a6 GIT binary patch literal 38912 zcmeI53vgA(dB^u&9SH#zkqPFh!a)d7YD0t`AOw>2LI_iAzz#Gm8J@=221I1iC+#S$ zlMs(PC3YtE)Jz`Jy3>g>3BlBpvE76?#AVXjC3WK&r%6Y40At74;LyZw#=iai_nejP zz0yUxpoax#rT_i*y?efWoZbDtyZ6L@T-*7zZ%=*Mq?tOCW8P1UHhD?@G3>R@U1&@_ zcKN-ZNF?N42e3wF1aaVvN55}Ym?<7jH~xESL}O@K3_kZ=XUsUW<*qGv9e(`q@LD5tmVt0Q#9Ew@7~-K!uTSGL;J<(HN^QY zC`yX|8c+TN?$bc#Qt5W`iIaYZc-v1}LcFi!8gqeR_24LDPU60w^Z_@NOSf^)@9Nhb z64;!7CaQd8+BJkREbiPLwYLsU10~{0PR>M@)ekZDue&>bzDv zp4{ka^nMQ>$aNzeYVc~p(bn6zDkD@QuMVzO*}Te08;sUE(z-TKnHrs?rjoeIF=(Mi z?*=$nL)xXGtFYpZ4`OwZ&a5}u932aQJasX zxoRlK!|;_Atz|OJMbTO&6K4j`e;`9?QCzd;Avc~9>;A!w(a1=ZPj)C^1`G0THJKzlOfd{VTeJ~!W5IFE*+@Kxt z+wH{Cl$FM}z0+XF10)w-aA8HRN&~xj4y` zr;_8vkVvqEM!V`Ba|eGnnkG23!K_CM=VtzH!@kMrE+-Y{2+ljX!jJv_gPt_7- z$m%y_dG4JoU93iyu#GadB9C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