aboutsummaryrefslogtreecommitdiffstats
path: root/fop-core
diff options
context:
space:
mode:
authorSimon Steiner <ssteiner@apache.org>2023-04-04 14:03:17 +0100
committerSimon Steiner <ssteiner@apache.org>2023-04-04 14:03:17 +0100
commitaa9091d44d190a65b696f12f9d84cfe32524086d (patch)
treea3d50604c0accc839cb58101b2df76c03d120053 /fop-core
parentb7eeb45bea9fa9fbc462a338c84d65876da263c7 (diff)
downloadxmlgraphics-fop-aa9091d44d190a65b696f12f9d84cfe32524086d.tar.gz
xmlgraphics-fop-aa9091d44d190a65b696f12f9d84cfe32524086d.zip
FOP-3127: Fix test
Diffstat (limited to 'fop-core')
-rw-r--r--fop-core/src/test/java/org/apache/fop/pdf/PDFPageXMPTestCase.java15
1 files changed, 13 insertions, 2 deletions
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 {