mirror of
https://github.com/apache/poi.git
synced 2025-02-11 12:34:51 +00:00
bug 52949: prepare for adding DOC/DOCM and PPT/PPTM test cases
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1738438 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
17a339549d
commit
a560514759
@ -49,29 +49,23 @@ public class TestVBAMacroReader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void fromStream() throws Exception {
|
public void HSSFfromStream() throws Exception {
|
||||||
VBAMacroReader r;
|
fromStream(POIDataSamples.getSpreadSheetInstance(), "SimpleMacro.xls");
|
||||||
|
|
||||||
r = new VBAMacroReader(HSSFTestDataSamples.openSampleFileStream("SimpleMacro.xls"));
|
|
||||||
assertMacroContents(r);
|
|
||||||
r.close();
|
|
||||||
|
|
||||||
r = new VBAMacroReader(HSSFTestDataSamples.openSampleFileStream("SimpleMacro.xlsm"));
|
|
||||||
assertMacroContents(r);
|
|
||||||
r.close();
|
|
||||||
}
|
}
|
||||||
@Test
|
@Test
|
||||||
public void fromFile() throws Exception {
|
public void XSSFfromStream() throws Exception {
|
||||||
VBAMacroReader r;
|
fromStream(POIDataSamples.getSpreadSheetInstance(), "SimpleMacro.xlsm");
|
||||||
|
|
||||||
r = new VBAMacroReader(HSSFTestDataSamples.getSampleFile("SimpleMacro.xls"));
|
|
||||||
assertMacroContents(r);
|
|
||||||
r.close();
|
|
||||||
|
|
||||||
r = new VBAMacroReader(HSSFTestDataSamples.getSampleFile("SimpleMacro.xlsm"));
|
|
||||||
assertMacroContents(r);
|
|
||||||
r.close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void HSSFfromFile() throws Exception {
|
||||||
|
fromFile(POIDataSamples.getSpreadSheetInstance(), "SimpleMacro.xls");
|
||||||
|
}
|
||||||
|
@Test
|
||||||
|
public void XSSFfromFile() throws Exception {
|
||||||
|
fromFile(POIDataSamples.getSpreadSheetInstance(), "SimpleMacro.xlsm");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void fromNPOIFS() throws Exception {
|
public void fromNPOIFS() throws Exception {
|
||||||
NPOIFSFileSystem fs = new NPOIFSFileSystem(
|
NPOIFSFileSystem fs = new NPOIFSFileSystem(
|
||||||
@ -80,6 +74,28 @@ public class TestVBAMacroReader {
|
|||||||
assertMacroContents(r);
|
assertMacroContents(r);
|
||||||
r.close();
|
r.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void fromFile(POIDataSamples poiDataSamples, String filename) {
|
||||||
|
File f = poiDataSamples.getSampleFile(filename);
|
||||||
|
VBAMacroReader r = new VBAMacroReader(f);
|
||||||
|
try {
|
||||||
|
assertMacroContents(r);
|
||||||
|
} finally {
|
||||||
|
r.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void fromStream(POIDataSamples poiDataSamples, String filename) {
|
||||||
|
InputStream fis = poiDataSamples.openSampleFileStream(filename);
|
||||||
|
try {
|
||||||
|
VBAMacroReader r = new VBAMacroReader(fis);
|
||||||
|
try {
|
||||||
|
assertMacroContents(r);
|
||||||
|
} finally {
|
||||||
|
r.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected void assertMacroContents(VBAMacroReader r) throws Exception {
|
protected void assertMacroContents(VBAMacroReader r) throws Exception {
|
||||||
Map<String,String> contents = r.readMacros();
|
Map<String,String> contents = r.readMacros();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user