pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1814938 - /pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/multipdf/PDFMergerUtilityTest.java
Date Sat, 11 Nov 2017 10:20:22 GMT
Author: tilman
Date: Sat Nov 11 10:20:22 2017
New Revision: 1814938

URL: http://svn.apache.org/viewvc?rev=1814938&view=rev
Log:
PDFBOX-3999: use PD instead of COS class for test to increase usage of that class in the project

Modified:
    pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/multipdf/PDFMergerUtilityTest.java

Modified: pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/multipdf/PDFMergerUtilityTest.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/multipdf/PDFMergerUtilityTest.java?rev=1814938&r1=1814937&r2=1814938&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/multipdf/PDFMergerUtilityTest.java
(original)
+++ pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/multipdf/PDFMergerUtilityTest.java
Sat Nov 11 10:20:22 2017
@@ -32,6 +32,7 @@ import org.apache.pdfbox.pdmodel.PDDocum
 import org.apache.pdfbox.pdmodel.PDPage;
 import org.apache.pdfbox.pdmodel.PDPageTree;
 import org.apache.pdfbox.pdmodel.common.PDNumberTreeNode;
+import org.apache.pdfbox.pdmodel.documentinterchange.logicalstructure.PDStructureElement;
 import org.apache.pdfbox.pdmodel.interactive.documentnavigation.destination.PDPageDestination;
 import org.apache.pdfbox.pdmodel.interactive.documentnavigation.destination.PDPageFitDestination;
 import org.apache.pdfbox.rendering.PDFRenderer;
@@ -193,12 +194,14 @@ public class PDFMergerUtilityTest extend
                     {
                         base2 = ((COSObject) base2).getObject();
                     }
-                    checkForPage(pageTree, base2);
+                    PDStructureElement structureElement = new PDStructureElement((COSDictionary)
base2);
+                    checkForPage(pageTree, structureElement);
                 }
             }
             else if (base instanceof COSDictionary)
             {
-                checkForPage(pageTree, base);
+                PDStructureElement structureElement = new PDStructureElement((COSDictionary)
base);
+                checkForPage(pageTree, structureElement);
             }
         }
     }
@@ -269,12 +272,11 @@ public class PDFMergerUtilityTest extend
         }
     }
 
-    private void checkForPage(PDPageTree pageTree, COSBase base2)
+    private void checkForPage(PDPageTree pageTree, PDStructureElement structureElement)
     {
-        COSDictionary dict = (COSDictionary) base2;
-        if (dict.containsKey(COSName.PG))
+        PDPage page = structureElement.getPage();
+        if (page != null)
         {
-            PDPage page = new PDPage((COSDictionary) dict.getDictionaryObject(COSName.PG));
             assertTrue("Page is not in the page tree", pageTree.indexOf(page) != -1);
         }
     }



Mime
View raw message