aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2021-11-29 16:09:06 +0000
committerPJ Fanning <fanningpj@apache.org>2021-11-29 16:09:06 +0000
commit53da548689712143fb84f357d2de6d2fafd00a33 (patch)
tree116f7ebf7b0bf614a5c079f30bb4e724b1ddd37e
parent8df5b234ad067b4387097d91e2773e25a46ffba5 (diff)
downloadpoi-53da548689712143fb84f357d2de6d2fafd00a33.tar.gz
poi-53da548689712143fb84f357d2de6d2fafd00a33.zip
[bug-65711] add test
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1895407 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--poi-ooxml/src/test/java/org/apache/poi/xslf/usermodel/TestXSLFSheet.java21
-rw-r--r--test-data/slideshow/chart-slide-bg.pptxbin0 -> 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
new file mode 100644
index 0000000000..b746dbb336
--- /dev/null
+++ b/test-data/slideshow/chart-slide-bg.pptx
Binary files differ