From: Simon Steiner Date: Tue, 4 Apr 2023 13:03:17 +0000 (+0100) Subject: FOP-3127: Fix test X-Git-Tag: 2_9~21 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=aa9091d44d190a65b696f12f9d84cfe32524086d;p=xmlgraphics-fop.git FOP-3127: Fix test --- diff --git a/fop-core/src/test/java/org/apache/fop/pdf/PDFPageXMPTestCase.java b/fop-core/src/test/java/org/apache/fop/pdf/PDFPageXMPTestCase.java index 870e85998..bd3886aa6 100644 --- a/fop-core/src/test/java/org/apache/fop/pdf/PDFPageXMPTestCase.java +++ b/fop-core/src/test/java/org/apache/fop/pdf/PDFPageXMPTestCase.java @@ -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 45f63975c..fa2f14aae 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,7 @@ 2.18.1 3.3.2 1.0.1 - 2.8.0-SNAPSHOT + 2.9.0-SNAPSHOT 1.2 ${env.JAVA_HOME}