]> source.dussan.org Git - poi.git/commitdiff
Add test which shows that bug 51262 is fixed now
authorDominik Stadler <centic@apache.org>
Mon, 9 Oct 2017 19:35:32 +0000 (19:35 +0000)
committerDominik Stadler <centic@apache.org>
Mon, 9 Oct 2017 19:35:32 +0000 (19:35 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1811595 13f79535-47bb-0310-9956-ffa450edef68

src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
test-data/spreadsheet/51262.xls [new file with mode: 0644]

index 7288945b948a5effd1bcb579e74aed2d887ebf85..ebaa9ae66c72f6d4323d838e23804d3d16e513c0 100644 (file)
@@ -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 (file)
index 0000000..86ad84d
Binary files /dev/null and b/test-data/spreadsheet/51262.xls differ