poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ye...@apache.org
Subject svn commit: r788948 - in /poi/trunk/src/scratchpad: src/org/apache/poi/hslf/usermodel/SlideShow.java testcases/org/apache/poi/hslf/data/47261.ppt testcases/org/apache/poi/hslf/usermodel/TestAddingSlides.java
Date Sat, 27 Jun 2009 10:25:23 GMT
Author: yegor
Date: Sat Jun 27 10:25:23 2009
New Revision: 788948

URL: http://svn.apache.org/viewvc?rev=788948&view=rev
Log:
fixed typo in SlideShow.removeSlide which prevened deletion of slide's notes, see Bugzilla
47261

Modified:
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/data/47261.ppt
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestAddingSlides.java

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java?rev=788948&r1=788947&r2=788948&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/SlideShow.java Sat Jun 27 10:25:23
2009
@@ -590,6 +590,10 @@
         ArrayList<Record> records = new ArrayList<Record>();
         ArrayList<SlideAtomsSet> sa = new ArrayList<SlideAtomsSet>();
         ArrayList<Slide> sl = new ArrayList<Slide>();
+
+        ArrayList<Notes> nt = new ArrayList<Notes>();
+        for(Notes notes : getNotes()) nt.add(notes);
+
         for (int i = 0, num = 0; i < _slides.length; i++){
             if(i != index) {
                 sl.add(_slides[i]);
@@ -599,6 +603,7 @@
                 records.addAll(Arrays.asList(sas[i].getSlideRecords()));
             } else {
                 removedSlide = _slides[i];
+                nt.remove(_slides[i].getNotesSheet());
             }
         }
         if(sa.size() == 0){
@@ -610,8 +615,9 @@
         _slides = sl.toArray(new Slide[sl.size()]);
 
         //if the removed slide had notes - remove references to them too
+
         if(removedSlide != null){
-            int notesId = removedSlide.getSlideRecord().getSlideAtom().getNotesID();
+             int notesId = removedSlide.getSlideRecord().getSlideAtom().getNotesID();
             if(notesId != 0){
                 SlideListWithText nslwt = _documentRecord.getNotesSlideListWithText();
                 records = new ArrayList<Record>();
@@ -626,13 +632,13 @@
                 if(na.size() == 0){
                     _documentRecord.removeSlideListWithText(nslwt);
                 } else {
-                    slwt.setSlideAtomsSets( na.toArray(new SlideAtomsSet[na.size()]) );
-                    slwt.setChildRecord(records.toArray(new Record[records.size()]));
+                    nslwt.setSlideAtomsSets( na.toArray(new SlideAtomsSet[na.size()]) );
+                    nslwt.setChildRecord(records.toArray(new Record[records.size()]));
                 }
 
             }
-
         }
+        _notes = nt.toArray(new Notes[nt.size()]);
 
         return removedSlide;
     }

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/data/47261.ppt
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/data/47261.ppt?rev=788948&r1=788947&r2=788948&view=diff
==============================================================================
Binary files - no diff available.

Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestAddingSlides.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestAddingSlides.java?rev=788948&r1=788947&r2=788948&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestAddingSlides.java
(original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestAddingSlides.java
Sat Jun 27 10:25:23 2009
@@ -279,15 +279,18 @@
         Slide[] slides = ppt.getSlides();
         Document doc = ppt.getDocumentRecord();
         assertNotNull(doc.getSlideSlideListWithText());
-        assertEquals(1, ppt.getSlides().length);
+        assertEquals(14, ppt.getSlides().length);
         int notesId = slides[0].getSlideRecord().getSlideAtom().getNotesID();
         assertTrue(notesId > 0);
         assertNotNull(doc.getNotesSlideListWithText());
-        //the SLWT container for notes has one entry which will deleted
-        assertEquals(1, doc.getNotesSlideListWithText().getSlideAtomsSets().length);
+        assertEquals(14, doc.getNotesSlideListWithText().getSlideAtomsSets().length);
 
-        ppt.removeSlide(0);
+        //remove all slides, corresponding notes should be removed too
+        for (int i = 0; i < slides.length; i++) {
+            ppt.removeSlide(0);
+        }
         assertEquals(0, ppt.getSlides().length);
+        assertEquals(0, ppt.getNotes().length);
         assertNull(doc.getSlideSlideListWithText());
         assertNull(doc.getNotesSlideListWithText());
 



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message