From 53da548689712143fb84f357d2de6d2fafd00a33 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Mon, 29 Nov 2021 16:09:06 +0000 Subject: [bug-65711] add test git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1895407 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/poi/xslf/usermodel/TestXSLFSheet.java | 21 +++++++++++++++++++++ test-data/slideshow/chart-slide-bg.pptx | Bin 0 -> 57330 bytes 2 files changed, 21 insertions(+) create mode 100644 test-data/slideshow/chart-slide-bg.pptx 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 new file mode 100644 index 0000000000..b746dbb336 Binary files /dev/null and b/test-data/slideshow/chart-slide-bg.pptx differ -- cgit v1.2.3