diff options
author | PJ Fanning <fanningpj@apache.org> | 2022-07-20 22:02:27 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2022-07-20 22:02:27 +0000 |
commit | 6dd67aa4942184bfd4ca9909b5318e466edca339 (patch) | |
tree | 1c0b4202508117fae78f4b23552868a4ca861286 | |
parent | b0b6747ce32a008ed858825156da363b3a4f7f71 (diff) | |
download | poi-6dd67aa4942184bfd4ca9909b5318e466edca339.tar.gz poi-6dd67aa4942184bfd4ca9909b5318e466edca339.zip |
test issue
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1902897 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestSheet.java | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestSheet.java b/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestSheet.java index bb70fa1c8f..61aceb97cb 100644 --- a/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestSheet.java +++ b/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestSheet.java @@ -804,7 +804,7 @@ public abstract class BaseTestSheet { } @Test - void testGetSetMargin() throws IOException { + void testGetSetMarginDeprecated() throws IOException { double[] defaultMargins = (getClass().getName().contains("xssf")) ? new double[]{0.7, 0.7, 0.75, 0.75, 0.3, 0.3} : new double[]{0.75, 0.75, 1.0, 1.0, 0.3, 0.3}; @@ -847,6 +847,42 @@ public abstract class BaseTestSheet { } @Test + void testGetSetMargin() throws IOException { + double[] defaultMargins = (getClass().getName().contains("xssf")) + ? new double[]{0.7, 0.7, 0.75, 0.75, 0.3, 0.3} + : new double[]{0.75, 0.75, 1.0, 1.0, 0.3, 0.3}; + + double marginLeft = defaultMargins[0]; + double marginRight = defaultMargins[1]; + double marginTop = defaultMargins[2]; + double marginBottom = defaultMargins[3]; + //double marginHeader = defaultMargins[4]; + //double marginFooter = defaultMargins[5]; + + try (Workbook workbook = _testDataProvider.createWorkbook()) { + Sheet sheet = workbook.createSheet("Sheet 1"); + assertEquals(marginLeft, sheet.getMargin(PageMargin.LEFT), 0.0); + sheet.setMargin(PageMargin.LEFT, 10.0); + //left margin is custom, all others are default + assertEquals(10.0, sheet.getMargin(PageMargin.LEFT), 0.0); + assertEquals(marginRight, sheet.getMargin(PageMargin.RIGHT), 0.0); + assertEquals(marginTop, sheet.getMargin(PageMargin.TOP), 0.0); + assertEquals(marginBottom, sheet.getMargin(PageMargin.BOTTOM), 0.0); + sheet.setMargin(PageMargin.RIGHT, 11.0); + assertEquals(11.0, sheet.getMargin(PageMargin.RIGHT), 0.0); + sheet.setMargin(PageMargin.TOP, 12.0); + assertEquals(12.0, sheet.getMargin(PageMargin.TOP), 0.0); + sheet.setMargin(PageMargin.BOTTOM, 13.0); + assertEquals(13.0, sheet.getMargin(PageMargin.BOTTOM), 0.0); + + sheet.setMargin(PageMargin.FOOTER, 5.6); + assertEquals(5.6, sheet.getMargin(PageMargin.FOOTER), 0.0); + sheet.setMargin(PageMargin.HEADER, 11.5); + assertEquals(11.5, sheet.getMargin(PageMargin.HEADER), 0.0); + } + } + + @Test void rowBreaks() throws IOException { try (Workbook workbook = _testDataProvider.createWorkbook()) { Sheet sheet = workbook.createSheet(); |