From 82c2ebf547471fb696c93bbbd072ebd833aead74 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Wed, 29 Apr 2015 18:31:12 +0000 Subject: [PATCH] Add a (disabled) unit test showing the incorrect ordering problem of parts - bug #57552 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1676810 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/xslf/TestXSLFBugs.java | 109 +++++++++++++++++- 1 file changed, 107 insertions(+), 2 deletions(-) diff --git a/src/ooxml/testcases/org/apache/poi/xslf/TestXSLFBugs.java b/src/ooxml/testcases/org/apache/poi/xslf/TestXSLFBugs.java index 7d18541d9b..9f28049fa9 100644 --- a/src/ooxml/testcases/org/apache/poi/xslf/TestXSLFBugs.java +++ b/src/ooxml/testcases/org/apache/poi/xslf/TestXSLFBugs.java @@ -18,6 +18,7 @@ package org.apache.poi.xslf; import static junit.framework.TestCase.assertEquals; import static org.apache.poi.POITestCase.assertContains; +import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; @@ -47,7 +48,6 @@ import org.apache.poi.xslf.usermodel.XSLFSlide; import org.apache.poi.xslf.usermodel.XSLFSlideLayout; import org.junit.Ignore; import org.junit.Test; - public class TestXSLFBugs { @Test @@ -259,6 +259,108 @@ public class TestXSLFBugs { ss.setSlideOrder(slide, 2); validateSlides(ss, true, "Slide1","Slide2","New slide"); } + + /** + * When working with >9 images, make sure the sorting ensures + * that image10.foo isn't between image1.foo and image2.foo + */ + @Test + @Ignore + public void test57552() throws Exception { + XMLSlideShow ss = new XMLSlideShow(); + for (String s : new String[]{"Slide1","Slide2"}) { + ss.createSlide().createTextBox().setText(s); + } + + // Slide starts with just layout relation + XSLFSlide slide = ss.getSlides()[0]; + assertEquals(0, ss.getAllPictures().size()); + assertEquals(1, slide.getShapes().length); + + assertEquals(1, slide.getRelations().size()); + assertRelationEquals(XSLFRelation.SLIDE_LAYOUT, slide.getRelations().get(0)); + + // Some dummy pictures + byte[][] pics = new byte[15][3]; + for (int i=0; i