COSArrayListTest.java (pdfbox-2.0.23-src) | : | COSArrayListTest.java (pdfbox-2.0.24-src) | ||
---|---|---|---|---|
skipping to change at line 341 | skipping to change at line 341 | |||
assertEquals("There shall be 4 annotations generated", 4, pageAnnots.siz e()); | assertEquals("There shall be 4 annotations generated", 4, pageAnnots.siz e()); | |||
page.setAnnotations(pageAnnots); | page.setAnnotations(pageAnnots); | |||
pdf.save(OUT_DIR + "/removeSingleDirectObjectTest.pdf"); | pdf.save(OUT_DIR + "/removeSingleDirectObjectTest.pdf"); | |||
pdf.close(); | pdf.close(); | |||
pdf = PDDocument.load(new File(OUT_DIR + "/removeSingleDirectObjectTest. pdf")); | pdf = PDDocument.load(new File(OUT_DIR + "/removeSingleDirectObjectTest. pdf")); | |||
page = pdf.getPage(0); | page = pdf.getPage(0); | |||
COSArrayList<PDAnnotation> annotations = (COSArrayList) page.getAnnotati ons(); | COSArrayList<PDAnnotation> annotations = (COSArrayList<PDAnnotation>) pa ge.getAnnotations(); | |||
assertEquals("There shall be 4 annotations retrieved", 4, annotations.si ze()); | assertEquals("There shall be 4 annotations retrieved", 4, annotations.si ze()); | |||
assertEquals("The size of the internal COSArray shall be 4", 4, annotati ons.getCOSArray().size()); | assertEquals("The size of the internal COSArray shall be 4", 4, annotati ons.getCOSArray().size()); | |||
PDAnnotation toBeRemoved = annotations.get(0); | PDAnnotation toBeRemoved = annotations.get(0); | |||
annotations.remove(toBeRemoved); | annotations.remove(toBeRemoved); | |||
assertEquals("There shall be 3 annotations left", 3, annotations.size()) ; | assertEquals("There shall be 3 annotations left", 3, annotations.size()) ; | |||
assertEquals("The size of the internal COSArray shall be 3", 3, annotati ons.getCOSArray().size()); | assertEquals("The size of the internal COSArray shall be 3", 3, annotati ons.getCOSArray().size()); | |||
skipping to change at line 381 | skipping to change at line 381 | |||
assertEquals("There shall be 4 annotations generated", 4, pageAnnots.siz e()); | assertEquals("There shall be 4 annotations generated", 4, pageAnnots.siz e()); | |||
page.setAnnotations(pageAnnots); | page.setAnnotations(pageAnnots); | |||
pdf.save(OUT_DIR + "/removeSingleIndirectObjectTest.pdf"); | pdf.save(OUT_DIR + "/removeSingleIndirectObjectTest.pdf"); | |||
pdf.close(); | pdf.close(); | |||
pdf = PDDocument.load(new File(OUT_DIR + "/removeSingleIndirectObjectTes t.pdf")); | pdf = PDDocument.load(new File(OUT_DIR + "/removeSingleIndirectObjectTes t.pdf")); | |||
page = pdf.getPage(0); | page = pdf.getPage(0); | |||
COSArrayList<PDAnnotation> annotations = (COSArrayList) page.getAnnotati ons(); | COSArrayList<PDAnnotation> annotations = (COSArrayList<PDAnnotation>) pa ge.getAnnotations(); | |||
assertEquals("There shall be 4 annotations retrieved", 4, annotations.si ze()); | assertEquals("There shall be 4 annotations retrieved", 4, annotations.si ze()); | |||
assertEquals("The size of the internal COSArray shall be 4", 4, annotati ons.getCOSArray().size()); | assertEquals("The size of the internal COSArray shall be 4", 4, annotati ons.getCOSArray().size()); | |||
PDAnnotation toBeRemoved = annotations.get(0); | PDAnnotation toBeRemoved = annotations.get(0); | |||
annotations.remove(toBeRemoved); | annotations.remove(toBeRemoved); | |||
assertEquals("There shall be 3 annotations left", 3, annotations.size()) ; | assertEquals("There shall be 3 annotations left", 3, annotations.size()) ; | |||
assertEquals("The size of the internal COSArray shall be 2", 3, annotati ons.getCOSArray().size()); | assertEquals("The size of the internal COSArray shall be 2", 3, annotati ons.getCOSArray().size()); | |||
skipping to change at line 430 | skipping to change at line 430 | |||
assertEquals("There shall be 4 annotations generated", 4, pageAnnots.siz e()); | assertEquals("There shall be 4 annotations generated", 4, pageAnnots.siz e()); | |||
page.setAnnotations(pageAnnots); | page.setAnnotations(pageAnnots); | |||
pdf.save(OUT_DIR + "/removeDirectObjectTest.pdf"); | pdf.save(OUT_DIR + "/removeDirectObjectTest.pdf"); | |||
pdf.close(); | pdf.close(); | |||
pdf = PDDocument.load(new File(OUT_DIR + "/removeDirectObjectTest.pdf")) ; | pdf = PDDocument.load(new File(OUT_DIR + "/removeDirectObjectTest.pdf")) ; | |||
page = pdf.getPage(0); | page = pdf.getPage(0); | |||
COSArrayList<PDAnnotation> annotations = (COSArrayList) page.getAnnotati ons(); | COSArrayList<PDAnnotation> annotations = (COSArrayList<PDAnnotation>) pa ge.getAnnotations(); | |||
assertEquals("There shall be 4 annotations retrieved", 4, annotations.si ze()); | assertEquals("There shall be 4 annotations retrieved", 4, annotations.si ze()); | |||
assertEquals("The size of the internal COSArray shall be 4", 4, annotati ons.getCOSArray().size()); | assertEquals("The size of the internal COSArray shall be 4", 4, annotati ons.getCOSArray().size()); | |||
ArrayList<PDAnnotation> toBeRemoved = new ArrayList<PDAnnotation>(); | ArrayList<PDAnnotation> toBeRemoved = new ArrayList<PDAnnotation>(); | |||
toBeRemoved.add(annotations.get(0)); | toBeRemoved.add(annotations.get(0)); | |||
annotations.removeAll(toBeRemoved); | annotations.removeAll(toBeRemoved); | |||
assertEquals("There shall be 1 annotations left", 1, annotations.size()) ; | assertEquals("There shall be 1 annotations left", 1, annotations.size()) ; | |||
skipping to change at line 472 | skipping to change at line 472 | |||
assertEquals("There shall be 4 annotations generated", 4, pageAnnots.siz e()); | assertEquals("There shall be 4 annotations generated", 4, pageAnnots.siz e()); | |||
page.setAnnotations(pageAnnots); | page.setAnnotations(pageAnnots); | |||
pdf.save(OUT_DIR + "/removeIndirectObjectTest.pdf"); | pdf.save(OUT_DIR + "/removeIndirectObjectTest.pdf"); | |||
pdf.close(); | pdf.close(); | |||
pdf = PDDocument.load(new File(OUT_DIR + "/removeIndirectObjectTest.pdf" )); | pdf = PDDocument.load(new File(OUT_DIR + "/removeIndirectObjectTest.pdf" )); | |||
page = pdf.getPage(0); | page = pdf.getPage(0); | |||
COSArrayList<PDAnnotation> annotations = (COSArrayList) page.getAnnotati ons(); | COSArrayList<PDAnnotation> annotations = (COSArrayList<PDAnnotation>) pa ge.getAnnotations(); | |||
assertEquals("There shall be 4 annotations retrieved", 4, annotations.si ze()); | assertEquals("There shall be 4 annotations retrieved", 4, annotations.si ze()); | |||
assertEquals("The size of the internal COSArray shall be 4", 4, annotati ons.getCOSArray().size()); | assertEquals("The size of the internal COSArray shall be 4", 4, annotati ons.getCOSArray().size()); | |||
ArrayList<PDAnnotation> toBeRemoved = new ArrayList<PDAnnotation>(); | ArrayList<PDAnnotation> toBeRemoved = new ArrayList<PDAnnotation>(); | |||
toBeRemoved.add(annotations.get(0)); | toBeRemoved.add(annotations.get(0)); | |||
annotations.removeAll(toBeRemoved); | annotations.removeAll(toBeRemoved); | |||
assertEquals("There shall be 1 annotations left", 1, annotations.size()) ; | assertEquals("There shall be 1 annotations left", 1, annotations.size()) ; | |||
skipping to change at line 522 | skipping to change at line 522 | |||
assertEquals("There shall be 4 annotations generated", 4, pageAnnots.siz e()); | assertEquals("There shall be 4 annotations generated", 4, pageAnnots.siz e()); | |||
page.setAnnotations(pageAnnots); | page.setAnnotations(pageAnnots); | |||
pdf.save(OUT_DIR + "/retainDirectObjectTest.pdf"); | pdf.save(OUT_DIR + "/retainDirectObjectTest.pdf"); | |||
pdf.close(); | pdf.close(); | |||
pdf = PDDocument.load(new File(OUT_DIR + "/retainDirectObjectTest.pdf")) ; | pdf = PDDocument.load(new File(OUT_DIR + "/retainDirectObjectTest.pdf")) ; | |||
page = pdf.getPage(0); | page = pdf.getPage(0); | |||
COSArrayList<PDAnnotation> annotations = (COSArrayList) page.getAnnotati ons(); | COSArrayList<PDAnnotation> annotations = (COSArrayList<PDAnnotation>) pa ge.getAnnotations(); | |||
assertEquals("There shall be 4 annotations retrieved", 4, annotations.si ze()); | assertEquals("There shall be 4 annotations retrieved", 4, annotations.si ze()); | |||
assertEquals("The size of the internal COSArray shall be 4", 4, annotati ons.getCOSArray().size()); | assertEquals("The size of the internal COSArray shall be 4", 4, annotati ons.getCOSArray().size()); | |||
ArrayList<PDAnnotation> toBeRetained = new ArrayList<PDAnnotation>(); | ArrayList<PDAnnotation> toBeRetained = new ArrayList<PDAnnotation>(); | |||
toBeRetained.add(annotations.get(0)); | toBeRetained.add(annotations.get(0)); | |||
annotations.retainAll(toBeRetained); | annotations.retainAll(toBeRetained); | |||
assertEquals("There shall be 3 annotations left", 3, annotations.size()) ; | assertEquals("There shall be 3 annotations left", 3, annotations.size()) ; | |||
skipping to change at line 572 | skipping to change at line 572 | |||
assertEquals("There shall be 4 annotations generated", 4, pageAnnots.siz e()); | assertEquals("There shall be 4 annotations generated", 4, pageAnnots.siz e()); | |||
page.setAnnotations(pageAnnots); | page.setAnnotations(pageAnnots); | |||
pdf.save(OUT_DIR + "/retainIndirectObjectTest.pdf"); | pdf.save(OUT_DIR + "/retainIndirectObjectTest.pdf"); | |||
pdf.close(); | pdf.close(); | |||
pdf = PDDocument.load(new File(OUT_DIR + "/retainIndirectObjectTest.pdf" )); | pdf = PDDocument.load(new File(OUT_DIR + "/retainIndirectObjectTest.pdf" )); | |||
page = pdf.getPage(0); | page = pdf.getPage(0); | |||
COSArrayList<PDAnnotation> annotations = (COSArrayList) page.getAnnotati ons(); | COSArrayList<PDAnnotation> annotations = (COSArrayList<PDAnnotation>) pa ge.getAnnotations(); | |||
assertEquals("There shall be 4 annotations retrieved", 4, annotations.si ze()); | assertEquals("There shall be 4 annotations retrieved", 4, annotations.si ze()); | |||
assertEquals("The size of the internal COSArray shall be 4", 4, annotati ons.getCOSArray().size()); | assertEquals("The size of the internal COSArray shall be 4", 4, annotati ons.getCOSArray().size()); | |||
ArrayList<PDAnnotation> toBeRetained = new ArrayList<PDAnnotation>(); | ArrayList<PDAnnotation> toBeRetained = new ArrayList<PDAnnotation>(); | |||
toBeRetained.add(annotations.get(0)); | toBeRetained.add(annotations.get(0)); | |||
annotations.retainAll(toBeRetained); | annotations.retainAll(toBeRetained); | |||
assertEquals("There shall be 3 annotations left", 3, annotations.size()) ; | assertEquals("There shall be 3 annotations left", 3, annotations.size()) ; | |||
End of changes. 6 change blocks. | ||||
6 lines changed or deleted | 6 lines changed or added |