diff options
author | PJ Fanning <fanningpj@apache.org> | 2022-03-15 09:40:48 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2022-03-15 09:40:48 +0000 |
commit | 935c8ab06a6dd7921b0d48067339aa9603b5a848 (patch) | |
tree | f18aa367ba05f1deee54935bada6ca64937c9cac /poi-ooxml/src/test | |
parent | f19233164c32a3af4ee8d0396adbda85290afc22 (diff) | |
download | poi-935c8ab06a6dd7921b0d48067339aa9603b5a848.tar.gz poi-935c8ab06a6dd7921b0d48067339aa9603b5a848.zip |
add xssf test (width/height)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1898944 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-ooxml/src/test')
-rw-r--r-- | poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFSheet.java | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFSheet.java b/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFSheet.java index 4dc4d622ef..385d0af869 100644 --- a/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFSheet.java +++ b/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFSheet.java @@ -18,6 +18,7 @@ package org.apache.poi.xssf.usermodel; import static java.util.concurrent.TimeUnit.SECONDS; +import static org.apache.poi.xssf.XSSFTestDataSamples.openSamplePackage; import static org.apache.poi.xssf.XSSFTestDataSamples.openSampleWorkbook; import static org.apache.poi.xssf.XSSFTestDataSamples.writeOutAndReadBack; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -2190,7 +2191,7 @@ public final class TestXSSFSheet extends BaseTestXSheet { } @Test - public void bug65120() throws IOException { + void bug65120() throws IOException { try (XSSFWorkbook wb = new XSSFWorkbook()) { XSSFCreationHelper creationHelper = wb.getCreationHelper(); @@ -2222,4 +2223,31 @@ public final class TestXSSFSheet extends BaseTestXSheet { } } + @Test + void testCustomWidthAndHeight() throws IOException { + try (XSSFWorkbook wb = (XSSFWorkbook) _testDataProvider.openSampleWorkbook("WidthsAndHeights.xlsx")) { + XSSFSheet sheet = wb.getSheetAt(0); + assertEquals(5120, sheet.getColumnWidth(0)); + assertEquals(2048, sheet.getColumnWidth(1)); + assertEquals(0, sheet.getColumnWidth(2)); + assertEquals(140.034, sheet.getColumnWidthInPixels(0), 0.00001); + assertEquals(56.0136, sheet.getColumnWidthInPixels(1), 0.00001); + assertEquals(0.0, sheet.getColumnWidthInPixels(2), 0.00001); + assertFalse(sheet.isColumnHidden(0)); + assertFalse(sheet.isColumnHidden(1)); + assertTrue(sheet.isColumnHidden(2)); + XSSFRow row0 = sheet.getRow(0); + assertEquals(750, row0.getHeight()); + assertEquals(37.5, row0.getHeightInPoints(), 0.00001); + assertFalse(row0.getZeroHeight()); + XSSFRow row1 = sheet.getRow(1); + assertEquals(300, row1.getHeight()); + assertEquals(15.0, row1.getHeightInPoints(), 0.00001); + assertFalse(row1.getZeroHeight()); + XSSFRow row2 = sheet.getRow(2); + assertEquals(15, row2.getHeight()); + assertEquals(0.75, row2.getHeightInPoints(), 0.00001); + assertTrue(row2.getZeroHeight()); + } + } } |