mirror of
https://github.com/apache/poi.git
synced 2026-02-27 20:40:08 +08:00
[github-321] add test case
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1899667 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0a6a042807
commit
05e8a16543
@ -43,6 +43,7 @@ import org.apache.poi.ss.usermodel.Comment;
|
||||
import org.apache.poi.ss.usermodel.DataFormatter;
|
||||
import org.apache.poi.ss.usermodel.Font;
|
||||
import org.apache.poi.ss.usermodel.FormulaError;
|
||||
import org.apache.poi.ss.usermodel.FormulaEvaluator;
|
||||
import org.apache.poi.ss.usermodel.RichTextString;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Row.MissingCellPolicy;
|
||||
@ -1398,6 +1399,21 @@ public final class TestXSSFWorkbook extends BaseTestXWorkbook {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void testGithub321() throws Exception {
|
||||
try (XSSFWorkbook wb = openSampleWorkbook("github-321.xlsx")) {
|
||||
XSSFSheet xssfSheet = wb.getSheetAt(0);
|
||||
DataFormatter dataFormatter = new DataFormatter();
|
||||
FormulaEvaluator formulaEvaluator = wb.getCreationHelper().createFormulaEvaluator();
|
||||
XSSFCell a3 = xssfSheet.getRow(2).getCell(0);
|
||||
assertEquals("2.05", dataFormatter.formatCellValue(a3));
|
||||
assertEquals("2.05", dataFormatter.formatCellValue(a3, formulaEvaluator));
|
||||
XSSFCell a4 = xssfSheet.getRow(3).getCell(0);
|
||||
assertEquals("2.1", dataFormatter.formatCellValue(a4));
|
||||
assertEquals("2.1", dataFormatter.formatCellValue(a4, formulaEvaluator));
|
||||
}
|
||||
}
|
||||
|
||||
private static void expectFormattedContent(Cell cell, String value) {
|
||||
assertEquals(value, new DataFormatter().formatCellValue(cell),
|
||||
"Cell " + ref(cell) + " has wrong formatted content.");
|
||||
|
||||
BIN
test-data/spreadsheet/github-321.xlsx
Normal file
BIN
test-data/spreadsheet/github-321.xlsx
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user