diff options
author | Andreas Beeker <kiwiwings@apache.org> | 2021-01-08 22:56:05 +0000 |
---|---|---|
committer | Andreas Beeker <kiwiwings@apache.org> | 2021-01-08 22:56:05 +0000 |
commit | fb2a96a04832a62c6ceb7bf5011b106547780ff9 (patch) | |
tree | 46c18c64c29fe92208fb819afa87be0c65f72687 /src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPicture.java | |
parent | 09464f1fea14d00273d782f3cefde26bda2b91f1 (diff) | |
download | poi-fb2a96a04832a62c6ceb7bf5011b106547780ff9.tar.gz poi-fb2a96a04832a62c6ceb7bf5011b106547780ff9.zip |
Sonar fixes
Fixed offset of compare picture in resize_compare.xlsx
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1885280 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPicture.java')
-rw-r--r-- | src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPicture.java | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPicture.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPicture.java index 5de42c63ef..51eea4a289 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPicture.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPicture.java @@ -17,6 +17,7 @@ package org.apache.poi.hssf.usermodel; +import static org.apache.poi.hssf.HSSFTestDataSamples.openSampleWorkbook; import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -32,6 +33,8 @@ import org.apache.poi.hssf.model.InternalSheet; import org.apache.poi.ss.usermodel.BaseTestPicture; import org.apache.poi.ss.usermodel.ClientAnchor; import org.apache.poi.ss.usermodel.CreationHelper; +import org.apache.poi.ss.usermodel.Drawing; +import org.apache.poi.ss.usermodel.Picture; import org.apache.poi.ss.usermodel.PictureData; import org.apache.poi.ss.usermodel.Workbook; import org.junit.jupiter.api.Test; @@ -42,16 +45,8 @@ public final class TestHSSFPicture extends BaseTestPicture { super(HSSFITestDataProvider.instance); } - @Test - public void resize() throws Exception { - try (HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("resize_compare.xls")) { - HSSFPatriarch dp = wb.getSheetAt(0).createDrawingPatriarch(); - List<HSSFShape> pics = dp.getChildren(); - HSSFPicture inpPic = (HSSFPicture) pics.get(0); - HSSFPicture cmpPic = (HSSFPicture) pics.get(1); - - baseTestResize(inpPic, cmpPic, 2.0, 2.0); - } + protected Picture getPictureShape(Drawing<?> pat, int picIdx) { + return (Picture)((HSSFPatriarch)pat).getChildren().get(picIdx); } /** @@ -199,7 +194,7 @@ public final class TestHSSFPicture extends BaseTestPicture { @Test public void readExistingImage() throws IOException { - try (HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("drawings.xls")) { + try (HSSFWorkbook wb = openSampleWorkbook("drawings.xls")) { HSSFSheet sheet = wb.getSheet("picture"); HSSFPatriarch drawing = sheet.getDrawingPatriarch(); assertEquals(1, drawing.getChildren().size()); |