diff options
author | PJ Fanning <fanningpj@apache.org> | 2023-11-07 12:00:57 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2023-11-07 12:00:57 +0000 |
commit | c9506f0f3911c5710a8e8c4c0945d0a6e227d308 (patch) | |
tree | 487d567bd01ec322a96e97c566bcd5659d319a35 /poi/src | |
parent | a57344e585ece269b8e860c7cd89e36c5334fad7 (diff) | |
download | poi-c9506f0f3911c5710a8e8c4c0945d0a6e227d308.tar.gz poi-c9506f0f3911c5710a8e8c4c0945d0a6e227d308.zip |
fix broken HSSFWorkbook test
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1913648 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi/src')
-rw-r--r-- | poi/src/test/java/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java | 14 | ||||
-rw-r--r-- | poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestWorkbook.java | 12 |
2 files changed, 19 insertions, 7 deletions
diff --git a/poi/src/test/java/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java b/poi/src/test/java/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java index 9cba23ff82..9d99627674 100644 --- a/poi/src/test/java/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java +++ b/poi/src/test/java/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java @@ -99,6 +99,15 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook { return wb.getWorkbook(); } + @Override + protected int getDrawingSizeForCreateDrawing1() { + return 225; + } + @Override + protected int getDrawingSizeForCreateDrawing2() { + return 171; + } + /** * Tests for {@link HSSFWorkbook#isHidden()} etc */ @@ -1217,11 +1226,6 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook { } } - @Disabled - void createDrawing() { - // the dimensions for this image are different than for XSSF and SXSSF - } - @Test void writeInvalidFile() throws Exception { try (Workbook wb = WorkbookFactory.create( diff --git a/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestWorkbook.java b/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestWorkbook.java index 0dc0bafbf6..7e16d69df6 100644 --- a/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestWorkbook.java +++ b/poi/src/test/java/org/apache/poi/ss/usermodel/BaseTestWorkbook.java @@ -872,6 +872,14 @@ public abstract class BaseTestWorkbook { } } + // these 2 values are overridden in TestHSSFWorkbook + protected int getDrawingSizeForCreateDrawing1() { + return 1609725; + } + protected int getDrawingSizeForCreateDrawing2() { + return 1114425; + } + // bug 51233 and 55075: correctly size image if added to a row with a custom height @Test void createDrawing() throws Exception { @@ -906,13 +914,13 @@ public abstract class BaseTestWorkbook { assertEquals(0, anchor.getRow1()); assertEquals(0, anchor.getRow2()); assertEquals(0, anchor.getDy1()); - assertEquals(1609725, anchor.getDy2()); //HSSF: 225 + assertEquals(getDrawingSizeForCreateDrawing1(), anchor.getDy2()); // Check drawing width assertEquals(0, anchor.getCol1()); assertEquals(0, anchor.getCol2()); assertEquals(0, anchor.getDx1()); - assertEquals(1114425, anchor.getDx2()); //HSSF: 171 + assertEquals(getDrawingSizeForCreateDrawing2(), anchor.getDx2()); } } |