add an ignored test for bug 58804
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1726681 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
183b2d774f
commit
f94bb63332
@ -18,14 +18,14 @@ package org.apache.poi.hwpf.usermodel;
|
|||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
|
||||||
|
|
||||||
import org.apache.commons.codec.digest.DigestUtils;
|
import org.apache.commons.codec.digest.DigestUtils;
|
||||||
import org.apache.poi.POIDataSamples;
|
import org.apache.poi.POIDataSamples;
|
||||||
import org.apache.poi.hwpf.HWPFDocument;
|
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.extractor.WordExtractor;
|
||||||
import org.apache.poi.hwpf.model.FieldsDocumentPart;
|
import org.apache.poi.hwpf.model.FieldsDocumentPart;
|
||||||
import org.apache.poi.hwpf.model.FileInformationBlock;
|
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.PlexOfField;
|
||||||
import org.apache.poi.hwpf.model.SubdocumentType;
|
import org.apache.poi.hwpf.model.SubdocumentType;
|
||||||
import org.apache.poi.hwpf.model.io.HWPFOutputStream;
|
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.POILogFactory;
|
||||||
import org.apache.poi.util.POILogger;
|
import org.apache.poi.util.POILogger;
|
||||||
|
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test different problems reported in Apache Bugzilla
|
* Test different problems reported in Apache Bugzilla
|
||||||
*
|
*
|
||||||
@ -183,6 +186,7 @@ public class TestBugs extends TestCase
|
|||||||
* Bug 44331 - HWPFDocument.write destroys fields
|
* Bug 44331 - HWPFDocument.write destroys fields
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void test44431() throws IOException
|
public void test44431() throws IOException
|
||||||
{
|
{
|
||||||
HWPFDocument doc1 = HWPFTestDataSamples.openSampleFile("Bug44431.doc");
|
HWPFDocument doc1 = HWPFTestDataSamples.openSampleFile("Bug44431.doc");
|
||||||
@ -306,6 +310,7 @@ public class TestBugs extends TestCase
|
|||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void test47286() throws IOException
|
public void test47286() throws IOException
|
||||||
{
|
{
|
||||||
HWPFDocument doc1 = HWPFTestDataSamples.openSampleFile("Bug47286.doc");
|
HWPFDocument doc1 = HWPFTestDataSamples.openSampleFile("Bug47286.doc");
|
||||||
|
@ -21,12 +21,15 @@ import static org.junit.Assert.assertEquals;
|
|||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.poi.POIDataSamples;
|
import org.apache.poi.POIDataSamples;
|
||||||
import org.apache.poi.hwpf.HWPFDocument;
|
import org.apache.poi.hwpf.HWPFDocument;
|
||||||
import org.apache.poi.hwpf.HWPFTestDataSamples;
|
import org.apache.poi.hwpf.HWPFTestDataSamples;
|
||||||
import org.apache.poi.hwpf.model.PicturesTable;
|
import org.apache.poi.hwpf.model.PicturesTable;
|
||||||
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -357,4 +360,42 @@ public final class TestPictures {
|
|||||||
|
|
||||||
assertEquals("This is the alternative text for the picture.", picture.getDescription());
|
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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
BIN
test-data/document/58804.doc
Normal file
BIN
test-data/document/58804.doc
Normal file
Binary file not shown.
BIN
test-data/document/58804_1.doc
Normal file
BIN
test-data/document/58804_1.doc
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user