Kaynağa Gözat

#65653 - HSLF FillType for texture and background color fills ignored

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1894538 13f79535-47bb-0310-9956-ffa450edef68
tags/REL_5_2_0
Andreas Beeker 2 yıl önce
ebeveyn
işleme
4b230fa142

+ 3
- 0
poi-scratchpad/src/main/java/org/apache/poi/hslf/usermodel/HSLFFill.java Dosyayı Görüntüle

@@ -254,6 +254,8 @@ public final class HSLFFill {
// need to handle (not only) the type (radial,rectangular,linear),
// the direction, e.g. top right, and bounds (e.g. for rectangular boxes)
switch (fillType) {
case FILL_BACKGROUND:
return DrawPaint.createSolidPaint(getBackgroundColor());
case FILL_SOLID:
return DrawPaint.createSolidPaint(getForegroundColor());
case FILL_SHADE_SHAPE:
@@ -264,6 +266,7 @@ public final class HSLFFill {
case FILL_SHADE:
case FILL_SHADE_SCALE:
return getGradientPaint(GradientType.linear);
case FILL_TEXTURE:
case FILL_PICTURE:
return getTexturePaint();
default:

+ 19
- 0
poi-scratchpad/src/test/java/org/apache/poi/hslf/usermodel/TestBugs.java Dosyayı Görüntüle

@@ -109,6 +109,25 @@ public final class TestBugs {
}
}

@Test
void fillTypesPaintMapping_65653() throws IOException {
try (HSLFSlideShow ppt = open("41246-2.ppt")) {
HSLFAutoShape as = (HSLFAutoShape) ppt.getSlides().get(15).getShapes().get(0);
HSLFFill f = as.getFill();
assertEquals(HSLFFill.FILL_TEXTURE, f.getFillType());
PaintStyle p = f.getFillStyle().getPaint();
assertTrue(p instanceof PaintStyle.TexturePaint);
}
try (HSLFSlideShow ppt = open("backgrounds.ppt")) {
HSLFAutoShape as = (HSLFAutoShape) ppt.getSlides().get(1).getShapes().get(0);
HSLFFill f = as.getFill();
assertEquals(HSLFFill.FILL_BACKGROUND, f.getFillType());
PaintStyle p = as.getFillStyle().getPaint();
assertTrue(p instanceof SolidPaint);
assertEquals(Color.WHITE, ((SolidPaint)p).getSolidColor().getColor());
}
}

/**
* First fix from Bug 42474: NPE in RichTextRun.isBold()
* when the RichTextRun comes from a Notes model object

BIN
poi/src/test/java9/module-info.class Dosyayı Görüntüle


Loading…
İptal
Kaydet