diff options
-rw-r--r-- | poi-ooxml/src/test/java/org/apache/poi/xslf/usermodel/TestXSLFSheet.java | 21 | ||||
-rw-r--r-- | test-data/slideshow/chart-slide-bg.pptx | bin | 0 -> 57330 bytes |
2 files changed, 21 insertions, 0 deletions
diff --git a/poi-ooxml/src/test/java/org/apache/poi/xslf/usermodel/TestXSLFSheet.java b/poi-ooxml/src/test/java/org/apache/poi/xslf/usermodel/TestXSLFSheet.java index da81218db2..1d8e105dec 100644 --- a/poi-ooxml/src/test/java/org/apache/poi/xslf/usermodel/TestXSLFSheet.java +++ b/poi-ooxml/src/test/java/org/apache/poi/xslf/usermodel/TestXSLFSheet.java @@ -16,6 +16,8 @@ ==================================================================== */ package org.apache.poi.xslf.usermodel; +import static org.apache.poi.xslf.XSLFTestDataSamples.openSampleDocument; +import static org.apache.poi.xslf.XSLFTestDataSamples.writeOutAndReadBack; import static org.junit.jupiter.api.Assertions.*; import java.io.IOException; @@ -70,4 +72,23 @@ class TestXSLFSheet { ppt.close(); ppt2.close(); } + + @Test + void testImportContent() throws Exception { + try (XMLSlideShow ppt = openSampleDocument("chart-slide-bg.pptx")) { + XSLFSlide sourceSlide = ppt.getSlides().get(0); + XSLFSlide targetSlide = ppt.createSlide(); + targetSlide.importContent(sourceSlide); + XSLFShape shape = targetSlide.getShapes().get(0); + assertNotNull(((XSLFGraphicFrame) shape).getChart(), "chart found?"); + assertEquals(2, targetSlide.getSlideNumber()); + try (XMLSlideShow ppt2 = writeOutAndReadBack(ppt)) { + XSLFSlide slide1 = ppt2.getSlides().get(1); + assertEquals(2, slide1.getSlideNumber()); + XSLFShape shape1 = targetSlide.getShapes().get(0); + assertNotNull(((XSLFGraphicFrame) shape1).getChart(), "chart found in slide1?"); + } + } + } + }
\ No newline at end of file diff --git a/test-data/slideshow/chart-slide-bg.pptx b/test-data/slideshow/chart-slide-bg.pptx Binary files differnew file mode 100644 index 0000000000..b746dbb336 --- /dev/null +++ b/test-data/slideshow/chart-slide-bg.pptx |