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.

TestPPTXMLDump.java 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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.hslf.dev;
  16. import org.apache.poi.EmptyFileException;
  17. import org.apache.poi.hslf.HSLFTestDataSamples;
  18. import org.junit.jupiter.api.Test;
  19. import java.io.File;
  20. import java.io.IOException;
  21. import java.util.Collections;
  22. import java.util.HashSet;
  23. import java.util.Set;
  24. import static org.junit.jupiter.api.Assertions.assertThrows;
  25. public class TestPPTXMLDump extends BaseTestPPTIterating {
  26. static final Set<String> LOCAL_EXCLUDED = new HashSet<>();
  27. static {
  28. LOCAL_EXCLUDED.add("clusterfuzz-testcase-minimized-POIHSLFFuzzer-5306877435838464.ppt");
  29. LOCAL_EXCLUDED.add("clusterfuzz-testcase-minimized-POIHSLFFuzzer-6032591399288832.ppt");
  30. }
  31. @Test
  32. void testMain() throws Exception {
  33. PPTXMLDump.main(new String[0]);
  34. PPTXMLDump.main(new String[]{
  35. HSLFTestDataSamples.getSampleFile("slide_master.ppt").getAbsolutePath(),
  36. HSLFTestDataSamples.getSampleFile("pictures.ppt").getAbsolutePath()
  37. });
  38. assertThrows(EmptyFileException.class, () -> PPTXMLDump.main(new String[]{"invalidfile"}));
  39. }
  40. @Override
  41. void runOneFile(File pFile) throws Exception {
  42. try {
  43. PPTXMLDump.main(new String[]{pFile.getAbsolutePath()});
  44. } catch (IndexOutOfBoundsException | IOException e) {
  45. if (!LOCAL_EXCLUDED.contains(pFile.getName())) {
  46. throw e;
  47. }
  48. }
  49. }
  50. @Override
  51. protected Set<String> getFailedEncryptedFiles() {
  52. return Collections.emptySet();
  53. }
  54. @Override
  55. protected Set<String> getFailedOldFiles() {
  56. return Collections.emptySet();
  57. }
  58. }