Author: ssteiner Date: Fri Jul 2 11:28:56 2021 New Revision: 1891199 URL: http://svn.apache.org/viewvc?rev=1891199&view=rev Log: Avoid using relative path for tests
Added: xmlgraphics/fop-pdf-images/trunk/test/resources/org/ xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/ xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/ xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/ xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/ xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/2fonts.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/2fonts.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/2fonts2.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/2fonts2.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/NoParentTree.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/NoParentTree.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/accessibleradiobuttons.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/accessibleradiobuttons.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/annot.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/annot.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/brokenLink.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/brokenLink.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/cffcid1.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/cffcid1.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/cffcid2.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/cffcid2.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/classMap.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/classMap.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/emptyRowTable.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/emptyRowTable.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/error.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/error.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/fontsnotembedded.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/fontsnotembedded.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/fontsnotembeddedcid.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/fontsnotembeddedcid.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/hello2.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/hello2.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/helloWorld.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/helloWorld.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/image.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/image.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/libreoffice.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/libreoffice.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/link.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/link.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/linkTagged.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/linkTagged.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/loop.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/loop.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/missingOBJR.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/missingOBJR.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/otf.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/otf.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/pattern.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/pattern.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/rotate.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/rotate.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/shading.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/shading.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/simpleh.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/simpleh.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/smask.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/smask.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/t1subset.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/t1subset.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/t1subset2.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/t1subset2.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/t1subset3.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/t1subset3.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/t1subset4.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/t1subset4.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/taggedWorld.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/taggedWorld.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/ttcid1.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/ttcid1.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/ttcid2.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/ttcid2.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/ttsubset.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/ttsubset.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/ttsubset2.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/ttsubset2.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/ttsubset3.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/ttsubset3.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/ttsubset5.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/ttsubset5.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/ttsubset6.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/ttsubset6.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/ttsubset7.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/ttsubset7.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/type0cff.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/type0cff.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/type0tt.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/type0tt.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/org/apache/fop/render/pdf/xform.pdf - copied unchanged from r1891198, xmlgraphics/fop-pdf-images/trunk/test/resources/xform.pdf Removed: xmlgraphics/fop-pdf-images/trunk/test/resources/2fonts.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/2fonts2.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/NoParentTree.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/accessibleradiobuttons.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/annot.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/brokenLink.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/cffcid1.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/cffcid2.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/classMap.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/emptyRowTable.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/error.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/fontsnotembedded.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/fontsnotembeddedcid.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/hello2.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/helloWorld.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/image.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/libreoffice.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/link.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/linkTagged.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/loop.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/missingOBJR.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/otf.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/pattern.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/rotate.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/shading.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/simpleh.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/smask.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/t1subset.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/t1subset2.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/t1subset3.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/t1subset4.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/taggedWorld.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/ttcid1.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/ttcid2.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/ttsubset.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/ttsubset2.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/ttsubset3.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/ttsubset5.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/ttsubset6.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/ttsubset7.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/type0cff.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/type0tt.pdf xmlgraphics/fop-pdf-images/trunk/test/resources/xform.pdf Modified: xmlgraphics/fop-pdf-images/trunk/build.xml xmlgraphics/fop-pdf-images/trunk/pom.xml xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/DocumentRootModifierTestCase.java xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/FOPPDFSingleMultiByteFontTestCase.java xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/ImageConverterPDF2G2DTestCase.java xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/PDFBoxAdapterTestCase.java xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/PDFRotateTestCase.java xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/PageParentTreeFinderTestCase.java xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/PreloaderPDFTestCase.java xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/StructureTreeMergerTestCase.java xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/TaggedPDFConductorTestCase.java Modified: xmlgraphics/fop-pdf-images/trunk/build.xml URL: http://svn.apache.org/viewvc/xmlgraphics/fop-pdf-images/trunk/build.xml?rev=1891199&r1=1891198&r2=1891199&view=diff ============================================================================== --- xmlgraphics/fop-pdf-images/trunk/build.xml (original) +++ xmlgraphics/fop-pdf-images/trunk/build.xml Fri Jul 2 11:28:56 2021 @@ -121,6 +121,7 @@ <formatter type="xml" usefile="true"/> <classpath> <pathelement location="${coverage.dir}" /> + <pathelement location="test/resources" /> <path refid="standard-junit-classpath"/> </classpath> <assertions> Modified: xmlgraphics/fop-pdf-images/trunk/pom.xml URL: http://svn.apache.org/viewvc/xmlgraphics/fop-pdf-images/trunk/pom.xml?rev=1891199&r1=1891198&r2=1891199&view=diff ============================================================================== --- xmlgraphics/fop-pdf-images/trunk/pom.xml (original) +++ xmlgraphics/fop-pdf-images/trunk/pom.xml Fri Jul 2 11:28:56 2021 @@ -42,6 +42,11 @@ <build> <sourceDirectory>src/java</sourceDirectory> <testSourceDirectory>test/java</testSourceDirectory> + <testResources> + <testResource> + <directory>test/resources</directory> + </testResource> + </testResources> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> Modified: xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/DocumentRootModifierTestCase.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/DocumentRootModifierTestCase.java?rev=1891199&r1=1891198&r2=1891199&view=diff ============================================================================== --- xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/DocumentRootModifierTestCase.java (original) +++ xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/DocumentRootModifierTestCase.java Fri Jul 2 11:28:56 2021 @@ -17,7 +17,6 @@ package org.apache.fop.render.pdf; import java.awt.geom.Rectangle2D; -import java.io.File; import java.io.IOException; import java.util.HashMap; @@ -42,7 +41,7 @@ import org.apache.fop.render.pdf.pdfbox. public class DocumentRootModifierTestCase { - private static final String CLASSMAP = "test/resources/classMap.pdf"; + private static final String CLASSMAP = "classMap.pdf"; @Test public void testStructTreeRootEntriesToCopy() throws IOException { @@ -83,7 +82,7 @@ public class DocumentRootModifierTestCas Assert.assertEquals(test, expected); - PDDocument doc = PDDocument.load(new File(CLASSMAP)); + PDDocument doc = PDFBoxAdapterTestCase.load(CLASSMAP); COSDictionary temp = (COSDictionary)doc.getDocumentCatalog().getStructureTreeRoot().getCOSObject(); PDFDictionary classMap = new PDFDictionary(); PDFDictionary inner = new PDFDictionary(); Modified: xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/FOPPDFSingleMultiByteFontTestCase.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/FOPPDFSingleMultiByteFontTestCase.java?rev=1891199&r1=1891198&r2=1891199&view=diff ============================================================================== --- xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/FOPPDFSingleMultiByteFontTestCase.java (original) +++ xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/FOPPDFSingleMultiByteFontTestCase.java Fri Jul 2 11:28:56 2021 @@ -16,7 +16,6 @@ */ package org.apache.fop.render.pdf; -import java.io.File; import java.io.IOException; import java.util.Arrays; import java.util.Set; @@ -56,7 +55,7 @@ public class FOPPDFSingleMultiByteFontTe @Test public void testCFF() throws Exception { - PDDocument doc = PDDocument.load(new File(PDFBoxAdapterTestCase.CFF1)); + PDDocument doc = PDFBoxAdapterTestCase.load(PDFBoxAdapterTestCase.CFF1); FOPPDFSingleByteFont sbfont = new FOPPDFSingleByteFont(getFont(doc, "R11"), "MyriadPro-Regular_Type1f0encstdcs"); @@ -68,7 +67,7 @@ public class FOPPDFSingleMultiByteFontTe Assert.assertEquals(sbfont.getFirstChar(), 87); Assert.assertEquals(sbfont.getLastChar(), 114); - PDDocument doc2 = PDDocument.load(new File(PDFBoxAdapterTestCase.CFF2)); + PDDocument doc2 = PDFBoxAdapterTestCase.load(PDFBoxAdapterTestCase.CFF2); String name = sbfont.addFont(getFont(doc2, "R11")); Assert.assertTrue(name.contains("MyriadPro")); @@ -91,7 +90,7 @@ public class FOPPDFSingleMultiByteFontTe @Test public void testCFF2() throws Exception { - PDDocument doc = PDDocument.load(new File(PDFBoxAdapterTestCase.CFF3)); + PDDocument doc = PDFBoxAdapterTestCase.load(PDFBoxAdapterTestCase.CFF3); FOPPDFSingleByteFont sbfont = new FOPPDFSingleByteFont(getFont(doc, "T1_0"), "Myriad_Pro_Type1f0encf1cs"); Assert.assertTrue(Arrays.asList(sbfont.getEncoding().getCharNameMap()).contains("uni004E")); @@ -109,13 +108,13 @@ public class FOPPDFSingleMultiByteFontTe @Test public void testTTCID() throws Exception { - PDDocument doc = PDDocument.load(new File(PDFBoxAdapterTestCase.TTCID1)); + PDDocument doc = PDFBoxAdapterTestCase.load(PDFBoxAdapterTestCase.TTCID1); FOPPDFMultiByteFont mbfont = new FOPPDFMultiByteFont(getFont(doc, "C2_0"), "ArialMT_Type0"); mbfont.addFont(getFont(doc, "C2_0")); Assert.assertEquals(mbfont.mapChar('t'), 67); - PDDocument doc2 = PDDocument.load(new File(PDFBoxAdapterTestCase.TTCID2)); + PDDocument doc2 = PDFBoxAdapterTestCase.load(PDFBoxAdapterTestCase.TTCID2); String name = mbfont.addFont(getFont(doc2, "C2_0")); Assert.assertEquals(name, "ArialMT_Type0"); Assert.assertEquals(mbfont.getFontName(), "ArialMT_Type0"); @@ -127,13 +126,13 @@ public class FOPPDFSingleMultiByteFontTe @Test public void testTTSubset() throws Exception { - PDDocument doc = PDDocument.load(new File(PDFBoxAdapterTestCase.TTSubset1)); + PDDocument doc = PDFBoxAdapterTestCase.load(PDFBoxAdapterTestCase.TTSubset1); FOPPDFSingleByteFont mbfont = new FOPPDFSingleByteFont(getFont(doc, "R9"), "TimesNewRomanPSMT_TrueType"); mbfont.addFont(getFont(doc, "R9")); // Assert.assertEquals(mbfont.mapChar('t'), 116); - PDDocument doc2 = PDDocument.load(new File(PDFBoxAdapterTestCase.TTSubset2)); + PDDocument doc2 = PDFBoxAdapterTestCase.load(PDFBoxAdapterTestCase.TTSubset2); String name = mbfont.addFont(getFont(doc2, "R9")); Assert.assertEquals(name, "TimesNewRomanPSMT_TrueType"); Assert.assertEquals(mbfont.getFontName(), "TimesNewRomanPSMT_TrueType"); @@ -145,10 +144,10 @@ public class FOPPDFSingleMultiByteFontTe @Test public void testType1Subset() throws Exception { - PDDocument doc = PDDocument.load(new File(PDFBoxAdapterTestCase.Type1Subset1)); + PDDocument doc = PDFBoxAdapterTestCase.load(PDFBoxAdapterTestCase.Type1Subset1); FOPPDFSingleByteFont mbfont = new FOPPDFSingleByteFont(getFont(doc, "F15"), ""); mbfont.addFont(getFont(doc, "F15")); - PDDocument doc2 = PDDocument.load(new File(PDFBoxAdapterTestCase.Type1Subset2)); + PDDocument doc2 = PDFBoxAdapterTestCase.load(PDFBoxAdapterTestCase.Type1Subset2); mbfont.addFont(getFont(doc2, "F15")); Type1Font f = Type1Font.createWithPFB(mbfont.getInputStream()); Set<String> csDict = new TreeSet<String>(f.getCharStringsDict().keySet()); @@ -161,7 +160,7 @@ public class FOPPDFSingleMultiByteFontTe @Test public void testHadMappingOperations() throws IOException { - PDDocument pdf = PDDocument.load(new File(PDFBoxAdapterTestCase.TTCID1)); + PDDocument pdf = PDFBoxAdapterTestCase.load(PDFBoxAdapterTestCase.TTCID1); COSDictionary font = getFont(pdf, "C2_0"); font.removeItem(COSName.TO_UNICODE); FOPPDFMultiByteFont multiByteFont = new FOPPDFMultiByteFont(font, null); @@ -171,7 +170,7 @@ public class FOPPDFSingleMultiByteFontTe @Test public void testMappingNotFound() throws IOException { - PDDocument pdf = PDDocument.load(new File(PDFBoxAdapterTestCase.TTCID1)); + PDDocument pdf = PDFBoxAdapterTestCase.load(PDFBoxAdapterTestCase.TTCID1); final COSDictionary fontDict = getFont(pdf, "C2_0"); MyFOPPDFMultiByteFont multiByteFont = new MyFOPPDFMultiByteFont(fontDict, null); PDType0Font font = (PDType0Font) multiByteFont.getFontContainer().getFont(); Modified: xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/ImageConverterPDF2G2DTestCase.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/ImageConverterPDF2G2DTestCase.java?rev=1891199&r1=1891198&r2=1891199&view=diff ============================================================================== --- xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/ImageConverterPDF2G2DTestCase.java (original) +++ xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/ImageConverterPDF2G2DTestCase.java Fri Jul 2 11:28:56 2021 @@ -56,8 +56,8 @@ import org.apache.fop.render.pdf.pdfbox. import org.apache.fop.render.pdf.pdfbox.PSPDFGraphics2D; public class ImageConverterPDF2G2DTestCase { - private static final String FONTSNOTEMBEDDED = "test/resources/fontsnotembedded.pdf"; - private static final String FONTSNOTEMBEDDEDCID = "test/resources/fontsnotembeddedcid.pdf"; + private static final String FONTSNOTEMBEDDED = "fontsnotembedded.pdf"; + private static final String FONTSNOTEMBEDDEDCID = "fontsnotembeddedcid.pdf"; @Test public void testFontsNotEmbedded() throws IOException, ImageException { @@ -66,14 +66,14 @@ public class ImageConverterPDF2G2DTestCa } private boolean pdfToPS(String pdf, String font) throws IOException, ImageException { - PDDocument doc = PDDocument.load(new File(pdf)); + PDDocument doc = PDFBoxAdapterTestCase.load(pdf); MyLazyFont lazyFont = new MyLazyFont(); pdfToPS(doc, pdf, font, lazyFont); return lazyFont.font.fontUsed; } private void pdfToPS(String pdf, LazyFont lazyFont) throws IOException, ImageException { - PDDocument doc = PDDocument.load(new File(pdf)); + PDDocument doc = PDFBoxAdapterTestCase.load(pdf); pdfToPS(doc, pdf, "NewsMinIWA-Th", lazyFont); } @@ -119,7 +119,7 @@ public class ImageConverterPDF2G2DTestCa @Test public void testPDFToImage() throws IOException, ImageException { - PDDocument doc = PDDocument.load(new File(FONTSNOTEMBEDDED)); + PDDocument doc = PDFBoxAdapterTestCase.load(FONTSNOTEMBEDDED); ImageInfo imgi = new ImageInfo(FONTSNOTEMBEDDED, "b"); org.apache.xmlgraphics.image.loader.Image img = new ImagePDF(imgi, doc); ImageConverterPDF2G2D imageConverterPDF2G2D = new ImageConverterPDF2G2D(); @@ -134,7 +134,7 @@ public class ImageConverterPDF2G2DTestCa @Test public void testCheckImageMask() throws IOException, ImageException { String pdf = PDFBoxAdapterTestCase.CFFCID1; - PDDocument doc = PDDocument.load(new File(pdf)); + PDDocument doc = PDFBoxAdapterTestCase.load(pdf); COSStream cosStream = new COSStream(); OutputStream outputStream = cosStream.createOutputStream(); outputStream.write("/Fm0 Do\n".getBytes("UTF-8")); Modified: xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/PDFBoxAdapterTestCase.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/PDFBoxAdapterTestCase.java?rev=1891199&r1=1891198&r2=1891199&view=diff ============================================================================== --- xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/PDFBoxAdapterTestCase.java (original) +++ xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/PDFBoxAdapterTestCase.java Fri Jul 2 11:28:56 2021 @@ -23,7 +23,6 @@ import java.awt.geom.Rectangle2D; import java.io.BufferedOutputStream; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; -import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -95,38 +94,38 @@ import org.apache.fop.render.ps.PSImageF import org.apache.fop.render.ps.PSRenderingUtil; public class PDFBoxAdapterTestCase { - protected static final String CFF1 = "test/resources/2fonts.pdf"; - protected static final String CFF2 = "test/resources/2fonts2.pdf"; - protected static final String CFF3 = "test/resources/simpleh.pdf"; - protected static final String TTCID1 = "test/resources/ttcid1.pdf"; - protected static final String TTCID2 = "test/resources/ttcid2.pdf"; - protected static final String TTSubset1 = "test/resources/ttsubset.pdf"; - protected static final String TTSubset2 = "test/resources/ttsubset2.pdf"; - private static final String TTSubset3 = "test/resources/ttsubset3.pdf"; - private static final String TTSubset5 = "test/resources/ttsubset5.pdf"; - private static final String TTSubset6 = "test/resources/ttsubset6.pdf"; - private static final String TTSubset7 = "test/resources/ttsubset7.pdf"; - protected static final String CFFCID1 = "test/resources/cffcid1.pdf"; - private static final String CFFCID2 = "test/resources/cffcid2.pdf"; - protected static final String Type1Subset1 = "test/resources/t1subset.pdf"; - protected static final String Type1Subset2 = "test/resources/t1subset2.pdf"; - private static final String Type1Subset3 = "test/resources/t1subset3.pdf"; - private static final String Type1Subset4 = "test/resources/t1subset4.pdf"; - protected static final String ROTATE = "test/resources/rotate.pdf"; - private static final String ANNOT = "test/resources/annot.pdf"; - private static final String SHADING = "test/resources/shading.pdf"; - private static final String LINK = "test/resources/link.pdf"; - private static final String IMAGE = "test/resources/image.pdf"; - private static final String HELLOTagged = "test/resources/taggedWorld.pdf"; - private static final String XFORM = "test/resources/xform.pdf"; - private static final String LOOP = "test/resources/loop.pdf"; - private static final String ERROR = "test/resources/error.pdf"; - private static final String LIBREOFFICE = "test/resources/libreoffice.pdf"; - private static final String SMASK = "test/resources/smask.pdf"; - private static final String TYPE0TT = "test/resources/type0tt.pdf"; - private static final String TYPE0CFF = "test/resources/type0cff.pdf"; - private static final String ACCESSIBLERADIOBUTTONS = "test/resources/accessibleradiobuttons.pdf"; - private static final String PATTERN = "test/resources/pattern.pdf"; + protected static final String CFF1 = "2fonts.pdf"; + protected static final String CFF2 = "2fonts2.pdf"; + protected static final String CFF3 = "simpleh.pdf"; + protected static final String TTCID1 = "ttcid1.pdf"; + protected static final String TTCID2 = "ttcid2.pdf"; + protected static final String TTSubset1 = "ttsubset.pdf"; + protected static final String TTSubset2 = "ttsubset2.pdf"; + private static final String TTSubset3 = "ttsubset3.pdf"; + private static final String TTSubset5 = "ttsubset5.pdf"; + private static final String TTSubset6 = "ttsubset6.pdf"; + private static final String TTSubset7 = "ttsubset7.pdf"; + protected static final String CFFCID1 = "cffcid1.pdf"; + private static final String CFFCID2 = "cffcid2.pdf"; + protected static final String Type1Subset1 = "t1subset.pdf"; + protected static final String Type1Subset2 = "t1subset2.pdf"; + private static final String Type1Subset3 = "t1subset3.pdf"; + private static final String Type1Subset4 = "t1subset4.pdf"; + protected static final String ROTATE = "rotate.pdf"; + private static final String ANNOT = "annot.pdf"; + private static final String SHADING = "shading.pdf"; + private static final String LINK = "link.pdf"; + private static final String IMAGE = "image.pdf"; + private static final String HELLOTagged = "taggedWorld.pdf"; + private static final String XFORM = "xform.pdf"; + private static final String LOOP = "loop.pdf"; + private static final String ERROR = "error.pdf"; + private static final String LIBREOFFICE = "libreoffice.pdf"; + private static final String SMASK = "smask.pdf"; + private static final String TYPE0TT = "type0tt.pdf"; + private static final String TYPE0CFF = "type0cff.pdf"; + private static final String ACCESSIBLERADIOBUTTONS = "accessibleradiobuttons.pdf"; + private static final String PATTERN = "pattern.pdf"; private static PDFPage getPDFPage(PDFDocument doc) { final Rectangle2D r = new Rectangle2D.Double(); @@ -143,6 +142,10 @@ public class PDFBoxAdapterTestCase { return new PDFBoxAdapter(pdfpage, new HashMap(), new HashMap<Integer, PDFArray>()); } + protected static PDDocument load(String pdf) throws IOException { + return PDDocument.load(PDFBoxAdapterTestCase.class.getResourceAsStream(pdf)); + } + @Test public void testPDFWriter() throws Exception { FontInfo fi = new FontInfo(); @@ -162,9 +165,9 @@ public class PDFBoxAdapterTestCase { msg = writeText(fi, TTCID2); Assert.assertTrue(msg, msg.contains("<000F00100001002A0034003F00430034003C00310034004100010010000E000F0011>")); msg = writeText(fi, CFFCID1); - Assert.assertTrue(msg, msg.contains("/Fm01700251251 Do")); + Assert.assertTrue(msg, msg.contains("/Fm0-1998009062 Do")); msg = writeText(fi, CFFCID2); - Assert.assertTrue(msg, msg.contains("/Fm01701174772 Do")); + Assert.assertTrue(msg, msg.contains("/Fm0-1997085541 Do")); msg = writeText(fi, Type1Subset1); Assert.assertTrue(msg, msg.contains("/Verdana_Type1")); msg = writeText(fi, Type1Subset2); @@ -172,7 +175,7 @@ public class PDFBoxAdapterTestCase { msg = writeText(fi, Type1Subset3); Assert.assertTrue(msg, msg.contains("/URWChanceryL-MediItal_Type1 20 Tf")); msg = writeText(fi, Type1Subset4); - Assert.assertTrue(msg, msg.contains("/F15-1521012718 40 Tf")); + Assert.assertTrue(msg, msg.contains("/F15_1683747577 40 Tf")); parseFonts(fi); } @@ -186,7 +189,7 @@ public class PDFBoxAdapterTestCase { @Test public void testMergeTT() throws IOException { - PDDocument doc = PDDocument.load(new File(TYPE0TT)); + PDDocument doc = load(TYPE0TT); PDType0Font type0Font = (PDType0Font) doc.getPage(0).getResources().getFont(COSName.getPDFName("C2_0")); PDCIDFontType2 ttf = (PDCIDFontType2) type0Font.getDescendantFont(); InputStream originalData = ttf.getTrueTypeFont().getOriginalData(); @@ -227,7 +230,7 @@ public class PDFBoxAdapterTestCase { } private String writeText(FontInfo fi, String pdf) throws IOException { - PDDocument doc = PDDocument.load(new File(pdf)); + PDDocument doc = load(pdf); PDPage page = doc.getPage(0); AffineTransform at = new AffineTransform(); String c = (String) getPDFBoxAdapter(true, false) @@ -240,7 +243,7 @@ public class PDFBoxAdapterTestCase { public void testTaggedPDFWriter() throws IOException { PDFBoxAdapter adapter = getPDFBoxAdapter(false, false); adapter.setCurrentMCID(5); - PDDocument doc = PDDocument.load(new File(HELLOTagged)); + PDDocument doc = load(HELLOTagged); PDPage page = doc.getPage(0); AffineTransform at = new AffineTransform(); Rectangle r = new Rectangle(0, 1650, 842000, 595000); @@ -256,7 +259,7 @@ public class PDFBoxAdapterTestCase { pdfpage.setDocument(pdfdoc); pdfpage.setObjectNumber(1); PDFBoxAdapter adapter = new PDFBoxAdapter(pdfpage, new HashMap(), new HashMap<Integer, PDFArray>()); - PDDocument doc = PDDocument.load(new File(ANNOT)); + PDDocument doc = load(ANNOT); PDPage page = doc.getPage(0); AffineTransform at = new AffineTransform(); Rectangle r = new Rectangle(0, 1650, 842000, 595000); @@ -272,7 +275,7 @@ public class PDFBoxAdapterTestCase { @Test public void testAnnot2() throws Exception { PDFBoxAdapter adapter = getPDFBoxAdapter(false, false); - PDDocument doc = PDDocument.load(new File(ANNOT)); + PDDocument doc = load(ANNOT); PDPage page = doc.getPage(0); COSArray annots = (COSArray) page.getCOSObject().getDictionaryObject(COSName.ANNOTS); COSDictionary dict = (COSDictionary) ((COSObject)annots.get(0)).getObject(); @@ -292,7 +295,7 @@ public class PDFBoxAdapterTestCase { pdfpage.setDocument(pdfdoc); pdfpage.setObjectNumber(1); PDFBoxAdapter adapter = new PDFBoxAdapter(pdfpage, new HashMap(), new HashMap<Integer, PDFArray>()); - PDDocument doc = PDDocument.load(new File(ACCESSIBLERADIOBUTTONS)); + PDDocument doc = load(ACCESSIBLERADIOBUTTONS); PDPage page = doc.getPage(0); AffineTransform at = new AffineTransform(); Rectangle r = new Rectangle(0, 1650, 842000, 595000); @@ -312,7 +315,7 @@ public class PDFBoxAdapterTestCase { pdfpage.setDocument(pdfdoc); pdfpage.setObjectNumber(1); PDFBoxAdapter adapter = new PDFBoxAdapter(pdfpage, new HashMap(), new HashMap<Integer, PDFArray>()); - PDDocument doc = PDDocument.load(new File(ACCESSIBLERADIOBUTTONS)); + PDDocument doc = load(ACCESSIBLERADIOBUTTONS); COSArray fields = (COSArray) doc.getDocumentCatalog().getAcroForm().getCOSObject().getDictionaryObject(COSName.FIELDS); fields.remove(0); @@ -334,7 +337,7 @@ public class PDFBoxAdapterTestCase { pdfpage.setObjectNumber(1); Map<Integer, PDFArray> pageNumbers = new HashMap<Integer, PDFArray>(); PDFBoxAdapter adapter = new PDFBoxAdapter(pdfpage, new HashMap(), pageNumbers); - PDDocument doc = PDDocument.load(new File(LINK)); + PDDocument doc = load(LINK); PDPage page = doc.getPage(0); AffineTransform at = new AffineTransform(); Rectangle r = new Rectangle(0, 1650, 842000, 595000); @@ -356,7 +359,7 @@ public class PDFBoxAdapterTestCase { pdfpage.setObjectNumber(1); Map<Integer, PDFArray> pageNumbers = new HashMap<Integer, PDFArray>(); PDFBoxAdapter adapter = new PDFBoxAdapter(pdfpage, new HashMap(), pageNumbers); - PDDocument doc = PDDocument.load(new File(XFORM)); + PDDocument doc = load(XFORM); PDPage page = doc.getPage(0); AffineTransform at = new AffineTransform(); Rectangle r = new Rectangle(0, 1650, 842000, 595000); @@ -428,7 +431,7 @@ public class PDFBoxAdapterTestCase { private ByteArrayOutputStream pdfToPS(String pdf) throws IOException, ImageException { ImageConverterPDF2G2D i = new ImageConverterPDF2G2D(); ImageInfo imgi = new ImageInfo(pdf, "b"); - PDDocument doc = PDDocument.load(new File(pdf)); + PDDocument doc = load(pdf); org.apache.xmlgraphics.image.loader.Image img = new ImagePDF(imgi, doc); ImageGraphics2D ig = (ImageGraphics2D)i.convert(img, null); GeneralGraphics2DImagePainter g = (GeneralGraphics2DImagePainter) ig.getGraphics2DImagePainter(); @@ -463,7 +466,7 @@ public class PDFBoxAdapterTestCase { private void pdfToPCL(String pdf) throws IOException, ImageException { ImageConverterPDF2G2D i = new ImageConverterPDF2G2D(); ImageInfo imgi = new ImageInfo(pdf, "b"); - PDDocument doc = PDDocument.load(new File(pdf)); + PDDocument doc = load(pdf); org.apache.xmlgraphics.image.loader.Image img = new ImagePDF(imgi, doc); ImageGraphics2D ig = (ImageGraphics2D)i.convert(img, null); ByteArrayOutputStream stream = new ByteArrayOutputStream(); @@ -506,7 +509,7 @@ public class PDFBoxAdapterTestCase { pdfdoc.assignObjectNumber(pdfpage); pdfpage.setDocument(pdfdoc); PDFBoxAdapter adapter = new PDFBoxAdapter(pdfpage, new HashMap(), new HashMap<Integer, PDFArray>()); - PDDocument doc = PDDocument.load(new File(src)); + PDDocument doc = load(src); PDPage page = doc.getPage(0); adapter.createStreamFromPDFBoxPage(doc, page, "key", new AffineTransform(), null, new Rectangle()); doc.close(); @@ -515,7 +518,7 @@ public class PDFBoxAdapterTestCase { @Test public void testPDFBoxImageHandler() throws Exception { ImageInfo imgi = new ImageInfo("a", "b"); - PDDocument doc = PDDocument.load(new File(SHADING)); + PDDocument doc = load(SHADING); ImagePDF img = new ImagePDF(imgi, doc); PDFDocument pdfdoc = new PDFDocument(""); PDFPage pdfpage = getPDFPage(pdfdoc); @@ -575,7 +578,7 @@ public class PDFBoxAdapterTestCase { pdfpage.setDocument(pdfdoc); PDFBoxAdapter adapter = new PDFBoxAdapter( pdfpage, objectCachePerFile, new HashMap<Integer, PDFArray>(), pdfCache); - PDDocument doc = PDDocument.load(new File(pdf)); + PDDocument doc = load(pdf); PDPage page = doc.getPage(0); String stream = (String) adapter.createStreamFromPDFBoxPage( doc, page, pdf, new AffineTransform(), null, new Rectangle()); @@ -621,7 +624,7 @@ public class PDFBoxAdapterTestCase { @Test public void testNoPageResource() throws IOException { - PDDocument doc = PDDocument.load(new File(CFF1)); + PDDocument doc = load(CFF1); PDPage page = doc.getPage(0); page.setResources(null); AffineTransform at = new AffineTransform(); @@ -632,7 +635,7 @@ public class PDFBoxAdapterTestCase { @Test public void testPDFBoxImageHandlerAccessibilityEnabled() throws Exception { ImageInfo imgi = new ImageInfo("a", "b"); - PDDocument doc = PDDocument.load(new File(SHADING)); + PDDocument doc = load(SHADING); ImagePDF img = new ImagePDF(imgi, doc); PDFDocument pdfdoc = new PDFDocument(""); PDFPage pdfpage = getPDFPage(pdfdoc); @@ -649,7 +652,7 @@ public class PDFBoxAdapterTestCase { @Test public void testMergeFontsAndFormXObject() throws IOException { String msg = ""; - PDDocument doc = PDDocument.load(new File(IMAGE)); + PDDocument doc = load(IMAGE); PDPage page = doc.getPage(0); AffineTransform at = new AffineTransform(); try { @@ -664,7 +667,7 @@ public class PDFBoxAdapterTestCase { @Test public void testFormXObject() throws IOException { - PDDocument doc = PDDocument.load(new File(IMAGE)); + PDDocument doc = load(IMAGE); PDPage page = doc.getPage(0); AffineTransform at = new AffineTransform(); PDFFormXObject formXObject = (PDFFormXObject) getPDFBoxAdapter(false, true) @@ -686,7 +689,7 @@ public class PDFBoxAdapterTestCase { pdfpage.setDocument(pdfdoc); pdfpage.setObjectNumber(1); PDFBoxAdapter adapter = new PDFBoxAdapter(pdfpage, new HashMap(), new HashMap<Integer, PDFArray>()); - PDDocument doc = PDDocument.load(new File(pdf)); + PDDocument doc = load(pdf); PDPage page = doc.getPage(0); AffineTransform at = new AffineTransform(); Rectangle r = new Rectangle(0, 1650, 842000, 595000); Modified: xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/PDFRotateTestCase.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/PDFRotateTestCase.java?rev=1891199&r1=1891198&r2=1891199&view=diff ============================================================================== --- xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/PDFRotateTestCase.java (original) +++ xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/PDFRotateTestCase.java Fri Jul 2 11:28:56 2021 @@ -22,7 +22,6 @@ package org.apache.fop.render.pdf; import java.awt.Rectangle; import java.awt.geom.AffineTransform; import java.awt.geom.Rectangle2D; -import java.io.File; import java.io.IOException; import org.junit.Assert; @@ -76,7 +75,7 @@ public class PDFRotateTestCase { private AffineTransform getTransform(int angle) throws IOException { PDFBoxAdapter adapter = PDFBoxAdapterTestCase.getPDFBoxAdapter(false, false); - PDDocument doc = PDDocument.load(new File(PDFBoxAdapterTestCase.ROTATE)); + PDDocument doc = PDFBoxAdapterTestCase.load(PDFBoxAdapterTestCase.ROTATE); PDPage page = doc.getPage(0); page.setRotation(angle); AffineTransform at = new AffineTransform(); Modified: xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/PageParentTreeFinderTestCase.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/PageParentTreeFinderTestCase.java?rev=1891199&r1=1891198&r2=1891199&view=diff ============================================================================== --- xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/PageParentTreeFinderTestCase.java (original) +++ xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/PageParentTreeFinderTestCase.java Fri Jul 2 11:28:56 2021 @@ -17,7 +17,6 @@ package org.apache.fop.render.pdf; -import java.io.File; import java.io.IOException; import org.junit.Assert; @@ -38,11 +37,11 @@ import org.apache.pdfbox.pdmodel.common. import org.apache.fop.render.pdf.pdfbox.PageParentTreeFinder; public class PageParentTreeFinderTestCase { - private static final String LINK = "test/resources/linkTagged.pdf"; + private static final String LINK = "linkTagged.pdf"; @Test public void testGetPageParentTreeArray() throws IOException { - PDDocument doc = PDDocument.load(new File(LINK)); + PDDocument doc = PDFBoxAdapterTestCase.load(LINK); PDPage srcPage = doc.getPage(0); PageParentTreeFinder finder = new PageParentTreeFinder(srcPage); COSArray markedContentParents = finder.getPageParentTreeArray(doc); @@ -80,7 +79,7 @@ public class PageParentTreeFinderTestCas @Test public void testTraverseKids() throws IOException { - PDDocument doc = PDDocument.load(new File(LINK)); + PDDocument doc = PDFBoxAdapterTestCase.load(LINK); PDNumberTreeNode srcNumberTreeNode = doc.getDocumentCatalog().getStructureTreeRoot().getParentTree(); COSArray parentTree = (COSArray) srcNumberTreeNode.getCOSObject().getDictionaryObject(COSName.KIDS); COSObject kidCOSObj = (COSObject) parentTree.get(0); @@ -94,7 +93,7 @@ public class PageParentTreeFinderTestCas @Test public void testCOSNull() throws IOException { - PDDocument doc = PDDocument.load(new File(LINK)); + PDDocument doc = PDFBoxAdapterTestCase.load(LINK); PDNumberTreeNode srcNumberTreeNode = doc.getDocumentCatalog().getStructureTreeRoot().getParentTree(); COSArray parentTree = (COSArray) srcNumberTreeNode.getCOSObject().getDictionaryObject(COSName.KIDS); COSObject kidCOSObj = (COSObject) parentTree.get(0); Modified: xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/PreloaderPDFTestCase.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/PreloaderPDFTestCase.java?rev=1891199&r1=1891198&r2=1891199&view=diff ============================================================================== --- xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/PreloaderPDFTestCase.java (original) +++ xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/PreloaderPDFTestCase.java Fri Jul 2 11:28:56 2021 @@ -20,8 +20,6 @@ import java.awt.image.DataBufferInt; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; -import java.io.File; -import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; @@ -64,10 +62,12 @@ public class PreloaderPDFTestCase { @Test public void testPreloaderPDF() throws Exception { - ImageSource imageSource = new ImageSource( - ImageIO.createImageInputStream(new File(PDFBoxAdapterTestCase.ROTATE)), "", true); - ImageInfo imageInfo = new PreloaderPDF().preloadImage("", imageSource, new DefaultImageContext()); - Assert.assertEquals(imageInfo.getMimeType(), "application/pdf"); + try (InputStream is = PreloaderPDFTestCase.class.getResourceAsStream(PDFBoxAdapterTestCase.ROTATE)) { + ImageSource imageSource = new ImageSource( + ImageIO.createImageInputStream(is), "", true); + ImageInfo imageInfo = new PreloaderPDF().preloadImage("", imageSource, new DefaultImageContext()); + Assert.assertEquals(imageInfo.getMimeType(), "application/pdf"); + } } @Test @@ -78,20 +78,21 @@ public class PreloaderPDFTestCase { } private void readPDF(DefaultImageContext context) throws IOException, ImageException { - ImageSource imageSource = new ImageSource( - ImageIO.createImageInputStream(new File(PDFBoxAdapterTestCase.ROTATE)), "", true); - ImageInfo imageInfo = new PreloaderPDF().preloadImage("", imageSource, context); - ImagePDF img = (ImagePDF) imageInfo.getOriginalImage(); - PDDocument doc = img.getPDDocument(); - doc.save(new ByteArrayOutputStream()); - img.close(); + try (InputStream is = PreloaderPDFTestCase.class.getResourceAsStream(PDFBoxAdapterTestCase.ROTATE)) { + ImageSource imageSource = new ImageSource(ImageIO.createImageInputStream(is), "", true); + ImageInfo imageInfo = new PreloaderPDF().preloadImage("", imageSource, context); + ImagePDF img = (ImagePDF) imageInfo.getOriginalImage(); + PDDocument doc = img.getPDDocument(); + doc.save(new ByteArrayOutputStream()); + img.close(); + } } @Test public void testLastResortPreloaderPDF() throws Exception { ByteArrayOutputStream bos = new ByteArrayOutputStream(); bos.write("xx".getBytes("UTF-8")); - IOUtils.copy(new FileInputStream(PDFBoxAdapterTestCase.ROTATE), bos); + IOUtils.copy(PreloaderPDFTestCase.class.getResourceAsStream(PDFBoxAdapterTestCase.ROTATE), bos); InputStream pdf = new ByteArrayInputStream(bos.toByteArray()); ImageInputStream inputStream = ImageIO.createImageInputStream(pdf); ImageSource imageSource = new ImageSource(inputStream, "", true); Modified: xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/StructureTreeMergerTestCase.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/StructureTreeMergerTestCase.java?rev=1891199&r1=1891198&r2=1891199&view=diff ============================================================================== --- xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/StructureTreeMergerTestCase.java (original) +++ xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/StructureTreeMergerTestCase.java Fri Jul 2 11:28:56 2021 @@ -18,7 +18,6 @@ package org.apache.fop.render.pdf; import java.awt.geom.Rectangle2D; -import java.io.File; import java.io.IOException; import java.util.HashMap; import java.util.List; @@ -53,16 +52,16 @@ import org.apache.fop.render.pdf.pdfbox. public class StructureTreeMergerTestCase { - private static final String LINK = "test/resources/linkTagged.pdf"; - private static final String BrokenLink = "test/resources/brokenLink.pdf"; - private static final String MissingOBJR = "test/resources/missingOBJR.pdf"; + private static final String LINK = "linkTagged.pdf"; + private static final String BrokenLink = "brokenLink.pdf"; + private static final String MissingOBJR = "missingOBJR.pdf"; private PDFPage pdfPage; private PDFDocument pdfDoc; private PDFBoxAdapter adapter; @Test public void testCopyStructure() throws IOException { - PDDocument doc = PDDocument.load(new File(LINK)); + PDDocument doc = PDFBoxAdapterTestCase.load(LINK); PDPage srcPage = doc.getPage(0); PageParentTreeFinder finder = new PageParentTreeFinder(srcPage); COSArray markedContentParents = finder.getPageParentTreeArray(doc); @@ -81,7 +80,7 @@ public class StructureTreeMergerTestCase @Test public void testNullEntriesInParentTree() throws IOException { - PDDocument doc = PDDocument.load(new File(LINK)); + PDDocument doc = PDFBoxAdapterTestCase.load(LINK); PDPage srcPage = doc.getPage(0); PageParentTreeFinder finder = new PageParentTreeFinder(srcPage); COSArray markedContentParents = finder.getPageParentTreeArray(doc); @@ -98,7 +97,7 @@ public class StructureTreeMergerTestCase @Test public void testOBJRCorrectPosition() throws IOException { - PDDocument doc = PDDocument.load(new File(MissingOBJR)); + PDDocument doc = PDFBoxAdapterTestCase.load(MissingOBJR); PDPage srcPage = doc.getPage(0); PageParentTreeFinder finder = new PageParentTreeFinder(srcPage); COSArray markedContentParents = finder.getPageParentTreeArray(doc); @@ -174,7 +173,7 @@ public class StructureTreeMergerTestCase @Test public void testCheckNullCOSObject() throws IOException { - PDDocument doc = PDDocument.load(new File(BrokenLink)); + PDDocument doc = PDFBoxAdapterTestCase.load(BrokenLink); PDPage srcPage = doc.getPage(0); PageParentTreeFinder finder = new PageParentTreeFinder(srcPage); COSArray markedContentParents = finder.getPageParentTreeArray(doc); Modified: xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/TaggedPDFConductorTestCase.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/TaggedPDFConductorTestCase.java?rev=1891199&r1=1891198&r2=1891199&view=diff ============================================================================== --- xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/TaggedPDFConductorTestCase.java (original) +++ xmlgraphics/fop-pdf-images/trunk/test/java/org/apache/fop/render/pdf/TaggedPDFConductorTestCase.java Fri Jul 2 11:28:56 2021 @@ -18,7 +18,6 @@ package org.apache.fop.render.pdf; import java.awt.geom.Rectangle2D; -import java.io.File; import java.io.IOException; import java.util.HashMap; import java.util.List; @@ -44,12 +43,12 @@ import org.apache.fop.render.pdf.pdfbox. public class TaggedPDFConductorTestCase { - private static final String LINK = "test/resources/linkTagged.pdf"; - private static final String HELLO = "test/resources/helloWorld.pdf"; - private static final String TABLE = "test/resources/emptyRowTable.pdf"; - private static final String OTF = "test/resources/otf.pdf"; - private static final String IMAGE = "test/resources/hello2.pdf"; - private static final String NOPARENTTREE = "test/resources/NoParentTree.pdf"; + private static final String LINK = "linkTagged.pdf"; + private static final String HELLO = "helloWorld.pdf"; + private static final String TABLE = "emptyRowTable.pdf"; + private static final String OTF = "otf.pdf"; + private static final String IMAGE = "hello2.pdf"; + private static final String NOPARENTTREE = "NoParentTree.pdf"; private PDFPage pdfPage; private PDFDocument pdfDoc; @@ -91,7 +90,7 @@ public class TaggedPDFConductorTestCase private void runConductor(String pdf, PDFStructElem elem) throws IOException { setUp(); - PDDocument doc = PDDocument.load(new File(pdf)); + PDDocument doc = PDFBoxAdapterTestCase.load(pdf); PDPage srcPage = doc.getPage(0); elem.setObjectNumber(2); PDFBoxAdapter adapter = new PDFBoxAdapter( --------------------------------------------------------------------- To unsubscribe, e-mail: fop-commits-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: fop-commits-h...@xmlgraphics.apache.org