mirror of https://github.com/apache/poi.git
byte-buddy 1.12.22
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1906653 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
56daedd9dd
commit
a00cc9ff2b
|
@ -285,8 +285,8 @@ under the License.
|
|||
<dependency prefix="main.hamcrest" artifact="org.hamcrest:hamcrest:2.2" usage="main-tests"/>
|
||||
<dependency prefix="main.xmlunit" artifact="org.xmlunit:xmlunit-core:2.9.1" usage="main-tests"/>
|
||||
<dependency prefix="main.mockito" artifact="org.mockito:mockito-core:4.11.0" usage="main-tests"/>
|
||||
<dependency prefix="main.byte-buddy" artifact="net.bytebuddy:byte-buddy:1.12.21" usage="main-tests"/>
|
||||
<dependency prefix="main.byte-buddy-agent" artifact="net.bytebuddy:byte-buddy-agent:1.12.21" usage="main-tests"/>
|
||||
<dependency prefix="main.byte-buddy" artifact="net.bytebuddy:byte-buddy:1.12.22" usage="main-tests"/>
|
||||
<dependency prefix="main.byte-buddy-agent" artifact="net.bytebuddy:byte-buddy-agent:1.12.22" usage="main-tests"/>
|
||||
<dependency prefix="main.objenesis" artifact="org.objenesis:objenesis:3.1" usage="main-tests"/>
|
||||
<dependency prefix="main.log4j-core" artifact="org.apache.logging.log4j:log4j-core:2.19.0" usage="main-tests"/>
|
||||
<dependency prefix="main.commons-logging" artifact="commons-logging:commons-logging:1.2" usage="main-tests"/>
|
||||
|
|
|
@ -22,8 +22,8 @@ sourceSets {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
api 'net.bytebuddy:byte-buddy:1.12.21'
|
||||
api 'net.bytebuddy:byte-buddy-agent:1.12.21'
|
||||
api 'net.bytebuddy:byte-buddy:1.12.22'
|
||||
api 'net.bytebuddy:byte-buddy-agent:1.12.22'
|
||||
api "org.apache.xmlbeans:xmlbeans:${xmlbeansVersion}"
|
||||
}
|
||||
|
||||
|
|
|
@ -23,13 +23,19 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
|
|||
import static org.junit.jupiter.api.Assertions.assertSame;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream;
|
||||
import org.apache.poi.POIDataSamples;
|
||||
import org.apache.poi.openxml4j.opc.ZipPackage;
|
||||
import org.apache.poi.ss.usermodel.BaseTestPicture;
|
||||
import org.apache.poi.ss.usermodel.ClientAnchor;
|
||||
import org.apache.poi.ss.usermodel.ClientAnchor.AnchorType;
|
||||
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.Workbook;
|
||||
import org.apache.poi.util.LocaleUtil;
|
||||
import org.apache.poi.xssf.XSSFITestDataProvider;
|
||||
import org.apache.poi.xssf.XSSFTestDataSamples;
|
||||
|
@ -123,6 +129,46 @@ public final class TestXSSFPicture extends BaseTestPicture {
|
|||
multiRelationships(true, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
void resizeWhenAnchorPositionIsZeroed() throws IOException {
|
||||
try (
|
||||
XSSFWorkbook workbook = new XSSFWorkbook();
|
||||
UnsynchronizedByteArrayOutputStream bos = new UnsynchronizedByteArrayOutputStream()
|
||||
) {
|
||||
XSSFSheet sheet = workbook.createSheet();
|
||||
CreationHelper helper = workbook.getCreationHelper();
|
||||
Drawing drawing = sheet.createDrawingPatriarch();
|
||||
|
||||
ClientAnchor anchor = helper.createClientAnchor();
|
||||
|
||||
final int pictureIndex;
|
||||
try (InputStream stream = POIDataSamples.getOpenXML4JInstance()
|
||||
.openResourceAsStream("thumbnail.jpg")) {
|
||||
pictureIndex = workbook.addPicture(stream, Workbook.PICTURE_TYPE_JPEG);
|
||||
}
|
||||
final XSSFPicture pict = (XSSFPicture) drawing.createPicture( anchor, pictureIndex );
|
||||
|
||||
assertEquals(0, anchor.getCol1());
|
||||
assertEquals(0, anchor.getCol2());
|
||||
assertEquals(0, anchor.getRow1());
|
||||
assertEquals(0, anchor.getRow2());
|
||||
|
||||
pict.resize();
|
||||
pict.resize(0.1,0.1);
|
||||
|
||||
assertEquals(0, anchor.getCol1());
|
||||
assertEquals(0, anchor.getCol2());
|
||||
assertEquals(0, anchor.getRow1());
|
||||
assertEquals(0, anchor.getRow2());
|
||||
|
||||
workbook.write(bos);
|
||||
|
||||
try (XSSFWorkbook wb2 = new XSSFWorkbook(bos.toInputStream())) {
|
||||
wb2.getAllPictures();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void multiRelationships(boolean tempFileParts, boolean encrypt) throws IOException {
|
||||
final boolean originalTempFileSetting = ZipPackage.useTempFilePackageParts();
|
||||
final boolean originalEncryptSetting = ZipPackage.encryptTempFilePackageParts();
|
||||
|
|
Loading…
Reference in New Issue