Преглед на файлове

#65228 - the method getCap() does not work correctly in xslf.usermodel.XSLFTextRun

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1889111 13f79535-47bb-0310-9956-ffa450edef68
tags/REL_5_1_0
Andreas Beeker преди 3 години
родител
ревизия
1d594451d8

+ 10
- 0
poi-ooxml/src/main/java/org/apache/poi/xslf/model/CharacterPropertyFetcher.java Целия файл



if (!(sheet instanceof XSLFSlideMaster)) { if (!(sheet instanceof XSLFSlideMaster)) {
fetchRunProp(); fetchRunProp();
fetchParagraphDefaultRunProp();
fetchShapeProp(shape); fetchShapeProp(shape);
fetchThemeProp(shape); fetchThemeProp(shape);
} }
fetchProp(run.getRPr(false)); fetchProp(run.getRPr(false));
} }


private void fetchParagraphDefaultRunProp() {
if (!isSet()) {
CTTextParagraphProperties pr = run.getParagraph().getXmlObject().getPPr();
if (pr != null) {
fetchProp(pr.getDefRPr());
}
}
}

private void fetchShapeProp(XSLFShape shape) { private void fetchShapeProp(XSLFShape shape) {
if (!isSet()) { if (!isSet()) {
shape.fetchShapeProperty(this); shape.fetchShapeProperty(this);

+ 15
- 19
poi-ooxml/src/test/java/org/apache/poi/xslf/TestXSLFBugs.java Целия файл

import org.apache.poi.sl.usermodel.VerticalAlignment; import org.apache.poi.sl.usermodel.VerticalAlignment;
import org.apache.poi.util.IOUtils; import org.apache.poi.util.IOUtils;
import org.apache.poi.util.NullPrintStream; import org.apache.poi.util.NullPrintStream;
import org.apache.poi.xslf.usermodel.XMLSlideShow;
import org.apache.poi.xslf.usermodel.XSLFAutoShape;
import org.apache.poi.xslf.usermodel.XSLFGroupShape;
import org.apache.poi.xslf.usermodel.XSLFHyperlink;
import org.apache.poi.xslf.usermodel.XSLFNotes;
import org.apache.poi.xslf.usermodel.XSLFObjectShape;
import org.apache.poi.xslf.usermodel.XSLFPictureData;
import org.apache.poi.xslf.usermodel.XSLFPictureShape;
import org.apache.poi.xslf.usermodel.XSLFRelation;
import org.apache.poi.xslf.usermodel.XSLFShape;
import org.apache.poi.xslf.usermodel.XSLFSlide;
import org.apache.poi.xslf.usermodel.XSLFSlideLayout;
import org.apache.poi.xslf.usermodel.XSLFSlideMaster;
import org.apache.poi.xslf.usermodel.XSLFTable;
import org.apache.poi.xslf.usermodel.XSLFTableCell;
import org.apache.poi.xslf.usermodel.XSLFTableRow;
import org.apache.poi.xslf.usermodel.XSLFTextBox;
import org.apache.poi.xslf.usermodel.XSLFTextParagraph;
import org.apache.poi.xslf.usermodel.XSLFTextRun;
import org.apache.poi.xslf.usermodel.*;
import org.apache.poi.xslf.util.DummyGraphics2d; import org.apache.poi.xslf.util.DummyGraphics2d;
import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Disabled;
} }
} }


@Test
public void bug65228() throws IOException {
try (XMLSlideShow ppt = openSampleDocument("bug65228.pptx")) {
TextRun.TextCap act = ppt.getSlides().stream()
.flatMap(s -> s.getShapes().stream())
.filter(s -> "März 2021\u2026".equals(s.getShapeName()))
.map(XSLFTextShape.class::cast)
.flatMap(s -> s.getTextParagraphs().stream())
.flatMap(s -> s.getTextRuns().stream())
.map(XSLFTextRun::getTextCap)
.findFirst().orElse(null);
assertEquals(TextRun.TextCap.ALL, act);
}
}
} }

+ 1
- 1
poi/src/main/java/org/apache/poi/sl/image/ImageHeaderEMF.java Целия файл

int top = LittleEndian.getInt(data, offset); offset += 4; int top = LittleEndian.getInt(data, offset); offset += 4;
int right = LittleEndian.getInt(data, offset); offset += 4; int right = LittleEndian.getInt(data, offset); offset += 4;
int bottom = LittleEndian.getInt(data, offset); offset += 4; int bottom = LittleEndian.getInt(data, offset); offset += 4;
deviceBounds = new Rectangle(left, top, right-left, bottom-top);
deviceBounds = new Rectangle(left, top, right-left == -1 ? 0 : right-left, bottom-top == -1 ? 0 : bottom-top);
// ignore frame bounds // ignore frame bounds
offset += 16; offset += 16;
String signature = new String(data, offset, EMF_SIGNATURE.length(), LocaleUtil.CHARSET_1252); String signature = new String(data, offset, EMF_SIGNATURE.length(), LocaleUtil.CHARSET_1252);

Двоични данни
test-data/slideshow/bug65228.pptx Целия файл


Loading…
Отказ
Запис