]> source.dussan.org Git - poi.git/commitdiff
test for TIKA-3163
authorPJ Fanning <fanningpj@apache.org>
Tue, 30 Aug 2022 11:10:46 +0000 (11:10 +0000)
committerPJ Fanning <fanningpj@apache.org>
Tue, 30 Aug 2022 11:10:46 +0000 (11:10 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1903775 13f79535-47bb-0310-9956-ffa450edef68

poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
test-data/spreadsheet/CVLKRA-KYC_Download_File_Structure_V3.1.xlsx [new file with mode: 0644]

index 4f12364294fd46a63f07c175d8026016af7d9078..7b5093d13ee5aea443c24ee954963273beb1c6b9 100644 (file)
@@ -96,7 +96,9 @@ import org.apache.poi.xssf.SXSSFITestDataProvider;
 import org.apache.poi.xssf.XLSBUnsupportedException;
 import org.apache.poi.xssf.XSSFITestDataProvider;
 import org.apache.poi.xssf.XSSFTestDataSamples;
+import org.apache.poi.xssf.eventusermodel.XSSFReader;
 import org.apache.poi.xssf.model.CalculationChain;
+import org.apache.poi.xssf.model.StylesTable;
 import org.apache.poi.xssf.streaming.SXSSFWorkbook;
 import org.apache.poi.xssf.usermodel.extensions.XSSFCellFill;
 import org.apache.xmlbeans.XmlException;
@@ -3724,4 +3726,22 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
             }
         }
     }
+
+    @Test
+    void testTika3163() throws Exception {
+        File file = XSSFTestDataSamples.getSampleFile("CVLKRA-KYC_Download_File_Structure_V3.1.xlsx");
+        try (
+                FileInputStream fis = new FileInputStream(file);
+                XSSFWorkbook workbook = new XSSFWorkbook(fis)
+        ) {
+            assertNotNull(workbook.getStylesSource());
+            assertEquals(23, workbook.getStylesSource().getFonts().size());
+        }
+        try (OPCPackage pkg = OPCPackage.open(file, PackageAccess.READ)) {
+            XSSFReader reader = new XSSFReader(pkg);
+            StylesTable stylesTable = reader.getStylesTable();
+            assertNotNull(stylesTable);
+            assertEquals(23, stylesTable.getFonts().size());
+        }
+    }
 }
\ No newline at end of file
diff --git a/test-data/spreadsheet/CVLKRA-KYC_Download_File_Structure_V3.1.xlsx b/test-data/spreadsheet/CVLKRA-KYC_Download_File_Structure_V3.1.xlsx
new file mode 100644 (file)
index 0000000..5a4c7c2
Binary files /dev/null and b/test-data/spreadsheet/CVLKRA-KYC_Download_File_Structure_V3.1.xlsx differ