You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

TestBiffViewer.java 2.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /* ====================================================================
  2. Licensed to the Apache Software Foundation (ASF) under one or more
  3. contributor license agreements. See the NOTICE file distributed with
  4. this work for additional information regarding copyright ownership.
  5. The ASF licenses this file to You under the Apache License, Version 2.0
  6. (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. ==================================================================== */
  15. package org.apache.poi.hssf.dev;
  16. import java.io.File;
  17. import java.io.IOException;
  18. import java.io.InputStream;
  19. import java.io.PrintStream;
  20. import java.util.List;
  21. public class TestBiffViewer extends BaseXLSIteratingTest {
  22. static {
  23. // Look at the output of the test for the detailed stacktrace of the failures...
  24. //EXCLUDED.add("");
  25. // these are likely ok to fail
  26. SILENT_EXCLUDED.add("XRefCalc.xls"); // "Buffer overrun"
  27. SILENT_EXCLUDED.add("50833.xls"); // "Name is too long" when setting username
  28. SILENT_EXCLUDED.add("OddStyleRecord.xls");
  29. SILENT_EXCLUDED.add("NoGutsRecords.xls");
  30. SILENT_EXCLUDED.add("51832.xls"); // password
  31. SILENT_EXCLUDED.add("43493.xls"); // HSSFWorkbook cannot open it as well
  32. SILENT_EXCLUDED.add("password.xls");
  33. SILENT_EXCLUDED.add("46904.xls");
  34. SILENT_EXCLUDED.add("35897-type4.xls"); // unsupported crypto api header
  35. SILENT_EXCLUDED.add("xor-encryption-abc.xls"); // unsupported XOR-encryption
  36. SILENT_EXCLUDED.add("testEXCEL_2.xls"); // Biff 2 / Excel 2, pre-OLE2
  37. SILENT_EXCLUDED.add("testEXCEL_3.xls"); // Biff 3 / Excel 3, pre-OLE2
  38. SILENT_EXCLUDED.add("testEXCEL_4.xls"); // Biff 4 / Excel 4, pre-OLE2
  39. SILENT_EXCLUDED.add("testEXCEL_5.xls"); // Biff 5 / Excel 5
  40. SILENT_EXCLUDED.add("testEXCEL_95.xls"); // Biff 5 / Excel 95
  41. }
  42. @Override
  43. void runOneFile(String dir, String file, List<String> failed) throws IOException {
  44. InputStream is = BiffViewer.getPOIFSInputStream(new File(dir, file));
  45. try {
  46. // use a NullOutputStream to not write the bytes anywhere for best runtime
  47. BiffViewer.runBiffViewer(new PrintStream(NULL_OUTPUT_STREAM), is, true, true, true, false);
  48. } finally {
  49. is.close();
  50. }
  51. }
  52. // @Test
  53. // public void testOneFile() throws Exception {
  54. // List<String> failed = new ArrayList<String>();
  55. // runOneFile("test-data/spreadsheet", "WORKBOOK_in_capitals.xls", failed);
  56. //
  57. // assertTrue("Expected to have no failed except the ones excluded, but had: " + failed,
  58. // failed.isEmpty());
  59. // }
  60. }