Tried to reproduce bug 61300, but could not.
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1808502 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f839090fe6
commit
445852e773
@ -18,33 +18,36 @@
|
|||||||
package org.apache.poi.hpsf.extractor;
|
package org.apache.poi.hpsf.extractor;
|
||||||
|
|
||||||
import static org.apache.poi.POITestCase.assertContains;
|
import static org.apache.poi.POITestCase.assertContains;
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
import junit.framework.TestCase;
|
|
||||||
|
|
||||||
import org.apache.poi.POIDataSamples;
|
import org.apache.poi.POIDataSamples;
|
||||||
import org.apache.poi.hpsf.Thumbnail;
|
import org.apache.poi.hpsf.*;
|
||||||
import org.apache.poi.hssf.HSSFTestDataSamples;
|
import org.apache.poi.hssf.HSSFTestDataSamples;
|
||||||
import org.apache.poi.hssf.extractor.ExcelExtractor;
|
import org.apache.poi.hssf.extractor.ExcelExtractor;
|
||||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||||
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
|
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
public final class TestHPSFPropertiesExtractor extends TestCase {
|
public final class TestHPSFPropertiesExtractor {
|
||||||
private static final POIDataSamples _samples = POIDataSamples.getHPSFInstance();
|
private static final POIDataSamples _samples = POIDataSamples.getHPSFInstance();
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testNormalProperties() throws Exception {
|
public void testNormalProperties() throws Exception {
|
||||||
POIFSFileSystem fs = new POIFSFileSystem(_samples.openResourceAsStream("TestMickey.doc"));
|
POIFSFileSystem fs = new POIFSFileSystem(_samples.openResourceAsStream("TestMickey.doc"));
|
||||||
HPSFPropertiesExtractor ext = new HPSFPropertiesExtractor(fs);
|
HPSFPropertiesExtractor ext = new HPSFPropertiesExtractor(fs);
|
||||||
try {
|
try {
|
||||||
// Check each bit in turn
|
// Check each bit in turn
|
||||||
String summary = ext.getSummaryInformationText();
|
String summary = ext.getSummaryInformationText();
|
||||||
String docsummary = ext.getDocumentSummaryInformationText();
|
String docSummary = ext.getDocumentSummaryInformationText();
|
||||||
|
|
||||||
assertContains(summary, "TEMPLATE = Normal");
|
assertContains(summary, "TEMPLATE = Normal");
|
||||||
assertContains(summary, "SUBJECT = sample subject");
|
assertContains(summary, "SUBJECT = sample subject");
|
||||||
assertContains(docsummary, "MANAGER = sample manager");
|
assertContains(docSummary, "MANAGER = sample manager");
|
||||||
assertContains(docsummary, "COMPANY = sample company");
|
assertContains(docSummary, "COMPANY = sample company");
|
||||||
|
|
||||||
// Now overall
|
// Now overall
|
||||||
String text = ext.getText();
|
String text = ext.getText();
|
||||||
@ -57,18 +60,19 @@ public final class TestHPSFPropertiesExtractor extends TestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testNormalUnicodeProperties() throws Exception {
|
public void testNormalUnicodeProperties() throws Exception {
|
||||||
POIFSFileSystem fs = new POIFSFileSystem(_samples.openResourceAsStream("TestUnicode.xls"));
|
POIFSFileSystem fs = new POIFSFileSystem(_samples.openResourceAsStream("TestUnicode.xls"));
|
||||||
HPSFPropertiesExtractor ext = new HPSFPropertiesExtractor(fs);
|
HPSFPropertiesExtractor ext = new HPSFPropertiesExtractor(fs);
|
||||||
try {
|
try {
|
||||||
// Check each bit in turn
|
// Check each bit in turn
|
||||||
String summary = ext.getSummaryInformationText();
|
String summary = ext.getSummaryInformationText();
|
||||||
String docsummary = ext.getDocumentSummaryInformationText();
|
String docSummary = ext.getDocumentSummaryInformationText();
|
||||||
|
|
||||||
assertContains(summary, "AUTHOR = marshall");
|
assertContains(summary, "AUTHOR = marshall");
|
||||||
assertContains(summary, "TITLE = Titel: \u00c4h");
|
assertContains(summary, "TITLE = Titel: \u00c4h");
|
||||||
assertContains(docsummary, "COMPANY = Schreiner");
|
assertContains(docSummary, "COMPANY = Schreiner");
|
||||||
assertContains(docsummary, "SCALE = false");
|
assertContains(docSummary, "SCALE = false");
|
||||||
|
|
||||||
// Now overall
|
// Now overall
|
||||||
String text = ext.getText();
|
String text = ext.getText();
|
||||||
@ -81,6 +85,7 @@ public final class TestHPSFPropertiesExtractor extends TestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testCustomProperties() throws Exception {
|
public void testCustomProperties() throws Exception {
|
||||||
POIFSFileSystem fs = new POIFSFileSystem(
|
POIFSFileSystem fs = new POIFSFileSystem(
|
||||||
_samples.openResourceAsStream("TestMickey.doc")
|
_samples.openResourceAsStream("TestMickey.doc")
|
||||||
@ -100,6 +105,7 @@ public final class TestHPSFPropertiesExtractor extends TestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testConstructors() throws IOException {
|
public void testConstructors() throws IOException {
|
||||||
POIFSFileSystem fs;
|
POIFSFileSystem fs;
|
||||||
HSSFWorkbook wb;
|
HSSFWorkbook wb;
|
||||||
@ -146,6 +152,7 @@ public final class TestHPSFPropertiesExtractor extends TestCase {
|
|||||||
assertContains(fsText, "TITLE = Titel: \u00c4h");
|
assertContains(fsText, "TITLE = Titel: \u00c4h");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void test42726() throws IOException {
|
public void test42726() throws IOException {
|
||||||
HPSFPropertiesExtractor ext = new HPSFPropertiesExtractor(HSSFTestDataSamples.openSampleWorkbook("42726.xls"));
|
HPSFPropertiesExtractor ext = new HPSFPropertiesExtractor(HSSFTestDataSamples.openSampleWorkbook("42726.xls"));
|
||||||
try {
|
try {
|
||||||
@ -159,6 +166,7 @@ public final class TestHPSFPropertiesExtractor extends TestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testThumbnail() throws Exception {
|
public void testThumbnail() throws Exception {
|
||||||
POIFSFileSystem fs = new POIFSFileSystem(_samples.openResourceAsStream("TestThumbnail.xls"));
|
POIFSFileSystem fs = new POIFSFileSystem(_samples.openResourceAsStream("TestThumbnail.xls"));
|
||||||
HSSFWorkbook wb = new HSSFWorkbook(fs);
|
HSSFWorkbook wb = new HSSFWorkbook(fs);
|
||||||
@ -169,6 +177,7 @@ public final class TestHPSFPropertiesExtractor extends TestCase {
|
|||||||
wb.close();
|
wb.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void test52258() throws Exception {
|
public void test52258() throws Exception {
|
||||||
POIFSFileSystem fs = new POIFSFileSystem(_samples.openResourceAsStream("TestVisioWithCodepage.vsd"));
|
POIFSFileSystem fs = new POIFSFileSystem(_samples.openResourceAsStream("TestVisioWithCodepage.vsd"));
|
||||||
HPSFPropertiesExtractor ext = new HPSFPropertiesExtractor(fs);
|
HPSFPropertiesExtractor ext = new HPSFPropertiesExtractor(fs);
|
||||||
@ -182,4 +191,11 @@ public final class TestHPSFPropertiesExtractor extends TestCase {
|
|||||||
ext.close();
|
ext.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test61300Extractor() throws NoPropertySetStreamException, MarkUnsupportedException, IOException {
|
||||||
|
HPSFPropertiesExtractor.main(new String[]{
|
||||||
|
POIDataSamples.getPOIFSInstance().getFile("61300.bin").getAbsolutePath()
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,11 +25,7 @@ import java.io.ByteArrayOutputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
import org.apache.poi.hpsf.MarkUnsupportedException;
|
import org.apache.poi.hpsf.*;
|
||||||
import org.apache.poi.hpsf.NoPropertySetStreamException;
|
|
||||||
import org.apache.poi.hpsf.PropertySetFactory;
|
|
||||||
import org.apache.poi.hpsf.SummaryInformation;
|
|
||||||
import org.apache.poi.hpsf.WritingNotSupportedException;
|
|
||||||
import org.apache.poi.hssf.HSSFTestDataSamples;
|
import org.apache.poi.hssf.HSSFTestDataSamples;
|
||||||
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
|
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
|
||||||
import org.apache.poi.util.HexDump;
|
import org.apache.poi.util.HexDump;
|
||||||
|
BIN
test-data/poifs/61300.bin
Normal file
BIN
test-data/poifs/61300.bin
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user