]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
FOP-3127: Fix test
authorSimon Steiner <ssteiner@apache.org>
Tue, 4 Apr 2023 13:03:17 +0000 (14:03 +0100)
committerSimon Steiner <ssteiner@apache.org>
Tue, 4 Apr 2023 13:03:17 +0000 (14:03 +0100)
fop-core/src/test/java/org/apache/fop/pdf/PDFPageXMPTestCase.java
pom.xml

index 870e859982fe0fe059d0e4861aa0f8e1e29e0588..bd3886aa6e2022e67245e3c0d0fd39cb5cf4e0f7 100644 (file)
@@ -70,7 +70,8 @@ public class PDFPageXMPTestCase {
     public void textFO() throws Exception {
         ByteArrayOutputStream out = new ByteArrayOutputStream();
         foToOutput(out, MimeConstants.MIME_PDF);
-        Assert.assertTrue(out.toString().replace("\r", "").contains(XMP));
+        String pdf = trimLines(out.toString());
+        Assert.assertTrue(pdf, pdf.contains(XMP));
     }
 
     @Test
@@ -78,7 +79,17 @@ public class PDFPageXMPTestCase {
         ByteArrayOutputStream out = new ByteArrayOutputStream();
         foToOutput(out, MimeConstants.MIME_FOP_IF);
         out = iFToPDF(new ByteArrayInputStream(out.toByteArray()));
-        Assert.assertTrue(out.toString().replace("\r", "").contains(XMP));
+        String pdf = trimLines(out.toString());
+        Assert.assertTrue(pdf, pdf.contains(XMP));
+    }
+
+    private String trimLines(String pdf) {
+        pdf = pdf.replace("\r", "");
+        StringBuilder sb = new StringBuilder();
+        for (String line : pdf.split("\n")) {
+            sb.append(line.trim()).append("\n");
+        }
+        return sb.toString();
     }
 
     private ByteArrayOutputStream iFToPDF(InputStream is) throws Exception {
diff --git a/pom.xml b/pom.xml
index 45f63975ce0bbf49dd369efcbed22a463384976e..fa2f14aaea1ec2696fa449e9bfa57d5164bef168 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -30,7 +30,7 @@
     <surefire.plugin.version>2.18.1</surefire.plugin.version>
     <war.plugin.version>3.3.2</war.plugin.version>
     <xml.plugin.version>1.0.1</xml.plugin.version>
-    <xmlgraphics.commons.version>2.8.0-SNAPSHOT</xmlgraphics.commons.version>
+    <xmlgraphics.commons.version>2.9.0-SNAPSHOT</xmlgraphics.commons.version>
     <xmlunit.version>1.2</xmlunit.version>
     <jdk.path>${env.JAVA_HOME}</jdk.path>
   </properties>