From: Dominik Stadler Date: Mon, 9 Oct 2017 19:35:32 +0000 (+0000) Subject: Add test which shows that bug 51262 is fixed now X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e24f25d0ef9b03ee41c7491eb68116f1ee683ac9;p=poi.git Add test which shows that bug 51262 is fixed now git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1811595 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java index 7288945b94..ebaa9ae66c 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java @@ -3137,4 +3137,32 @@ public final class TestBugs extends BaseTestBugzillaIssues { // this will throw an Exception "RuntimeException: Can't read negative number of bytes" new PropertySet(new DocumentInputStream(entry)); } + + @Test + public void test51262() throws IOException { + try (HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("51262.xls")) { + Sheet sheet = wb.getSheetAt(0); + Row row = sheet.getRow(2); + + Cell cell = row.getCell(1); + CellStyle style = cell.getCellStyle(); + assertEquals(26, style.getFontIndex()); + + row = sheet.getRow(3); + cell = row.getCell(1); + style = cell.getCellStyle(); + assertEquals(28, style.getFontIndex()); + + // check the two fonts + HSSFFont font = wb.getFontAt((short) 26); + assertTrue(font.getBold()); + assertEquals(10, font.getFontHeightInPoints()); + assertEquals("\uFF2D\uFF33 \uFF30\u30B4\u30B7\u30C3\u30AF", font.getFontName()); + + font = wb.getFontAt((short) 28); + assertTrue(font.getBold()); + assertEquals(10, font.getFontHeightInPoints()); + assertEquals("\uFF2D\uFF33 \uFF30\u30B4\u30B7\u30C3\u30AF", font.getFontName()); + } + } } diff --git a/test-data/spreadsheet/51262.xls b/test-data/spreadsheet/51262.xls new file mode 100644 index 0000000000..86ad84d4c1 Binary files /dev/null and b/test-data/spreadsheet/51262.xls differ