diff options
author | Dominik Stadler <centic@apache.org> | 2013-10-27 08:16:29 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2013-10-27 08:16:29 +0000 |
commit | 8812a4ea04c71ccb498a09b2a9d3558662aade59 (patch) | |
tree | 8261c6c0d7e5f7e6a7dc9dc4a76daabb04099178 /src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java | |
parent | 23d7dfa03708e2b57f7d71dfc55fefc70dce9de0 (diff) | |
download | poi-8812a4ea04c71ccb498a09b2a9d3558662aade59.tar.gz poi-8812a4ea04c71ccb498a09b2a9d3558662aade59.zip |
Re-use functionality from HSSFWorkbook in dev-tools to find the
dir-entry-name to make special names like WORKBOOK or BOOK work, handle
a special case in ExternalNameRecord when the flag states that there is
data, but no data remains in the stream, slightly improve error-output
in DirectoryNode, adjust all dev-tools-tests to not report stack-traces
any more for expected failures and try with HSSFWorkbook to decide if it
is an expected failure or now.
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1536062 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java')
-rw-r--r-- | src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java b/src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java index 19a915cfa2..6f73b7fa7c 100644 --- a/src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java +++ b/src/testcases/org/apache/poi/hssf/dev/TestBiffViewer.java @@ -1,45 +1,44 @@ package org.apache.poi.hssf.dev; import java.io.File; -import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintStream; import java.util.List; -import org.apache.poi.poifs.filesystem.POIFSFileSystem; - public class TestBiffViewer extends BaseXLSIteratingTest { static { - // TODO: is it ok to fail these? // Look at the output of the test for the detailed stacktrace of the failures... - EXCLUDED.add("WORKBOOK_in_capitals.xls"); - EXCLUDED.add("password.xls"); - EXCLUDED.add("NoGutsRecords.xls"); - EXCLUDED.add("BOOK_in_capitals.xls"); - EXCLUDED.add("XRefCalc.xls"); - EXCLUDED.add("50833.xls"); // probably a problem in BiffViewer - EXCLUDED.add("43493.xls"); - EXCLUDED.add("51832.xls"); - EXCLUDED.add("OddStyleRecord.xls"); - + //EXCLUDED.add(""); + + // these are likely ok to fail + SILENT_EXCLUDED.add("XRefCalc.xls"); // "Buffer overrun" + SILENT_EXCLUDED.add("50833.xls"); // "Name is too long" when setting username + SILENT_EXCLUDED.add("OddStyleRecord.xls"); + SILENT_EXCLUDED.add("NoGutsRecords.xls"); + SILENT_EXCLUDED.add("51832.xls"); // password + SILENT_EXCLUDED.add("43493.xls"); // HSSFWorkbook cannot open it as well + SILENT_EXCLUDED.add("password.xls"); SILENT_EXCLUDED.add("46904.xls"); }; @Override void runOneFile(String dir, String file, List<String> failed) throws IOException { - FileInputStream inStream = new FileInputStream(new File(dir, file)); + InputStream is = BiffViewer.getPOIFSInputStream(new File(dir, file)); try { - POIFSFileSystem fs = new POIFSFileSystem(inStream); - InputStream is = fs.createDocumentInputStream("Workbook"); - try { - // use a NullOutputStream to not write the bytes anywhere for best runtime - BiffViewer.runBiffViewer(new PrintStream(NULL_OUTPUT_STREAM), is, true, true, true, false); - } finally { - is.close(); - } + // use a NullOutputStream to not write the bytes anywhere for best runtime + BiffViewer.runBiffViewer(new PrintStream(NULL_OUTPUT_STREAM), is, true, true, true, false); } finally { - inStream.close(); + is.close(); } } + +// @Test +// public void testOneFile() throws Exception { +// List<String> failed = new ArrayList<String>(); +// runOneFile("test-data/spreadsheet", "WORKBOOK_in_capitals.xls", failed); +// +// assertTrue("Expected to have no failed except the ones excluded, but had: " + failed, +// failed.isEmpty()); +// } } |