[bug-67784] add tests

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1913068 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2023-10-17 16:05:08 +00:00
parent 818091f54d
commit e80ae0bb07
3 changed files with 38 additions and 0 deletions

View File

@ -362,4 +362,31 @@ class TestXSSFEventBasedExcelExtractor {
assertContains(text, "Bob\tBob");
}
}
@Test
void test67784() throws Exception {
try (XSSFEventBasedExcelExtractor ex =
new XSSFEventBasedExcelExtractor(
XSSFTestDataSamples.openSamplePackage("bug67784.xlsx"))) {
String text = ex.getText().replace("\r", "");
String[] lines = text.split("\n");
assertEquals("FALSE", lines[2]);
assertEquals("TRUE", lines[3]);
assertEquals("ERROR:#DIV/0!", lines[4]);
}
}
@Test
void test67784Formulas() throws Exception {
try (XSSFEventBasedExcelExtractor ex =
new XSSFEventBasedExcelExtractor(
XSSFTestDataSamples.openSamplePackage("bug67784.xlsx"))) {
ex.setFormulasNotResults(true);
String text = ex.getText().replace("\r", "");
String[] lines = text.split("\n");
assertEquals("(2 > 5)", lines[2]);
assertEquals("(2 < 4)", lines[3]);
assertEquals("10/0", lines[4]);
}
}
}

View File

@ -245,6 +245,17 @@ class TestXSSFExcelExtractor {
//in the extracted text
assertNotContained(text, "\u30CB\u30DB\u30F3");
}
}
@Test
void test67784Formulas() throws Exception {
try (XSSFExcelExtractor extractor = getExtractor("bug67784.xlsx")) {
extractor.setFormulasNotResults(true);
String text = extractor.getText().replace("\r", "");
String[] lines = text.split("\n");
assertEquals("(2 > 5)", lines[2]);
assertEquals("(2 < 4)", lines[3]);
assertEquals("10/0", lines[4]);
}
}
}

Binary file not shown.