aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2016-01-25 20:21:30 +0000
committerDominik Stadler <centic@apache.org>2016-01-25 20:21:30 +0000
commit805e8f1e91f07e5433d9d5797f5ba7c87f9e0a1e (patch)
treed2706960e372a97b2d6f62e6be7a6a9ff31f157d
parent33ba593407a69f0ed87a839c2747bea9824d2ac1 (diff)
downloadpoi-805e8f1e91f07e5433d9d5797f5ba7c87f9e0a1e.tar.gz
poi-805e8f1e91f07e5433d9d5797f5ba7c87f9e0a1e.zip
add an ignored test for bug 58804
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1726681 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBugs.java9
-rw-r--r--src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestPictures.java41
-rw-r--r--test-data/document/58804.docbin0 -> 306688 bytes
-rw-r--r--test-data/document/58804_1.docbin0 -> 61440 bytes
4 files changed, 48 insertions, 2 deletions
diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBugs.java b/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBugs.java
index 3aebf1401f..fbd466e983 100644
--- a/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBugs.java
+++ b/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBugs.java
@@ -18,14 +18,14 @@ package org.apache.poi.hwpf.usermodel;
import java.io.ByteArrayOutputStream;
import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.io.OutputStream;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
-import junit.framework.TestCase;
-
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.poi.POIDataSamples;
import org.apache.poi.hwpf.HWPFDocument;
@@ -37,6 +37,7 @@ import org.apache.poi.hwpf.extractor.Word6Extractor;
import org.apache.poi.hwpf.extractor.WordExtractor;
import org.apache.poi.hwpf.model.FieldsDocumentPart;
import org.apache.poi.hwpf.model.FileInformationBlock;
+import org.apache.poi.hwpf.model.PicturesTable;
import org.apache.poi.hwpf.model.PlexOfField;
import org.apache.poi.hwpf.model.SubdocumentType;
import org.apache.poi.hwpf.model.io.HWPFOutputStream;
@@ -45,6 +46,8 @@ import org.apache.poi.util.IOUtils;
import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger;
+import junit.framework.TestCase;
+
/**
* Test different problems reported in Apache Bugzilla
*
@@ -183,6 +186,7 @@ public class TestBugs extends TestCase
* Bug 44331 - HWPFDocument.write destroys fields
* @throws IOException
*/
+ @SuppressWarnings("deprecation")
public void test44431() throws IOException
{
HWPFDocument doc1 = HWPFTestDataSamples.openSampleFile("Bug44431.doc");
@@ -306,6 +310,7 @@ public class TestBugs extends TestCase
*
* @throws IOException
*/
+ @SuppressWarnings("deprecation")
public void test47286() throws IOException
{
HWPFDocument doc1 = HWPFTestDataSamples.openSampleFile("Bug47286.doc");
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 72b692e882..d1d340433c 100644
--- a/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestPictures.java
+++ b/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestPictures.java
@@ -21,12 +21,15 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import java.io.FileOutputStream;
+import java.io.OutputStream;
import java.util.List;
import org.apache.poi.POIDataSamples;
import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.HWPFTestDataSamples;
import org.apache.poi.hwpf.model.PicturesTable;
+import org.junit.Ignore;
import org.junit.Test;
/**
@@ -357,4 +360,42 @@ public final class TestPictures {
assertEquals("This is the alternative text for the picture.", picture.getDescription());
}
+
+ @Ignore("This bug is not fixed yet")
+ @Test
+ public void test58804_1() throws Exception {
+ HWPFDocument docA = HWPFTestDataSamples.openSampleFile("58804_1.doc");
+
+ expectImages(docA, 1);
+
+ HWPFDocument docB = HWPFTestDataSamples.writeOutAndReadBack(docA);
+
+ OutputStream out = new FileOutputStream("/tmp/58804_1_out.doc");
+ try {
+ docB.write(out);
+ } finally {
+ out.close();
+ }
+
+ expectImages(docB, 1);
+ }
+
+ @Ignore("This bug is not fixed yet")
+ @Test
+ public void test58804() throws Exception {
+ HWPFDocument docA = HWPFTestDataSamples.openSampleFile("58804.doc");
+
+ expectImages(docA, 7);
+
+ HWPFDocument docB = HWPFTestDataSamples.writeOutAndReadBack(docA);
+
+ expectImages(docB, 7);
+ }
+
+ private void expectImages(HWPFDocument docA, int expectedCount) {
+ assertNotNull(docA.getPicturesTable());
+ PicturesTable picA = docA.getPicturesTable();
+ List<Picture> picturesA = picA.getAllPictures();
+ assertEquals(expectedCount, picturesA.size());
+ }
}
diff --git a/test-data/document/58804.doc b/test-data/document/58804.doc
new file mode 100644
index 0000000000..64612730ed
--- /dev/null
+++ b/test-data/document/58804.doc
Binary files differ
diff --git a/test-data/document/58804_1.doc b/test-data/document/58804_1.doc
new file mode 100644
index 0000000000..c792079748
--- /dev/null
+++ b/test-data/document/58804_1.doc
Binary files differ