aboutsummaryrefslogtreecommitdiffstats
path: root/test/java
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2011-01-18 08:54:08 +0000
committerJeremias Maerki <jeremias@apache.org>2011-01-18 08:54:08 +0000
commit992d7e9d1d3a71209ae689eb60b5e3c15295fe2d (patch)
tree7fc8445564597ae49eb9b1a082d7f8498409a4bf /test/java
parentce6d9e1eeef5f7b17fada9f07145e7e430586bf1 (diff)
parent5a367c3b12e19af7a66fc923d7149bf22cdfb596 (diff)
downloadxmlgraphics-fop-992d7e9d1d3a71209ae689eb60b5e3c15295fe2d.tar.gz
xmlgraphics-fop-992d7e9d1d3a71209ae689eb60b5e3c15295fe2d.zip
Merge from Trunk, revisions 965390 to 1060234.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_Color@1060241 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/java')
-rw-r--r--test/java/org/apache/fop/GenericFOPTestCase.java13
-rw-r--r--test/java/org/apache/fop/StandardTestSuite.java2
-rw-r--r--test/java/org/apache/fop/URIResolutionTestCase.java4
-rw-r--r--test/java/org/apache/fop/config/BaseUserConfigTestCase.java2
-rw-r--r--test/java/org/apache/fop/events/EventChecker.java2
-rw-r--r--test/java/org/apache/fop/fonts/EncodingModeTest.java36
-rw-r--r--test/java/org/apache/fop/fonts/TrueTypeAnsiTestCase.java107
-rw-r--r--test/java/org/apache/fop/fonts/fonttest.xsl24
-rw-r--r--test/java/org/apache/fop/fotreetest/FOTreeUnitTester.java2
-rw-r--r--test/java/org/apache/fop/fotreetest/ext/TestElementMapping.java2
-rw-r--r--test/java/org/apache/fop/layoutengine/LayoutEngineTester.java2
-rw-r--r--test/java/org/apache/fop/memory/MemoryEater.java2
-rw-r--r--test/java/org/apache/fop/memory/Stats.java2
-rw-r--r--test/java/org/apache/fop/render/RendererFactoryTest.java15
-rw-r--r--test/java/org/apache/fop/render/pdf/PDFCMapTestCase.java60
-rw-r--r--test/java/org/apache/fop/render/ps/ImageHandlingTestCase.java48
-rw-r--r--test/java/org/apache/fop/render/ps/ResourceOptimizationTestCase.java22
-rw-r--r--test/java/org/apache/fop/text/linebreak/LineBreakStatusTest.java6
-rw-r--r--test/java/org/apache/fop/text/linebreak/LineBreakUtilsTest.java1
-rw-r--r--test/java/org/apache/fop/traits/BorderPropsTestCase.java1
-rw-r--r--test/java/org/apache/fop/util/DigestFilter.java4
-rw-r--r--test/java/org/apache/fop/visual/AbstractPSPDFBitmapProducer.java2
-rw-r--r--test/java/org/apache/fop/visual/BitmapProducerJava2D.java2
23 files changed, 103 insertions, 258 deletions
diff --git a/test/java/org/apache/fop/GenericFOPTestCase.java b/test/java/org/apache/fop/GenericFOPTestCase.java
index 26053cdad..5b51a34e1 100644
--- a/test/java/org/apache/fop/GenericFOPTestCase.java
+++ b/test/java/org/apache/fop/GenericFOPTestCase.java
@@ -31,12 +31,13 @@ import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
-import org.apache.fop.apps.Fop;
+import org.xml.sax.InputSource;
+
import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.apps.Fop;
import org.apache.fop.apps.FopFactory;
import org.apache.fop.apps.MimeConstants;
import org.apache.fop.util.DigestFilter;
-import org.xml.sax.InputSource;
/**
* Framework for simple regression testing.
@@ -76,8 +77,8 @@ public final class GenericFOPTestCase extends TestCase {
public void testSimple() throws Exception {
final String digestIn = "17bf13298796065f7775db8707133aeb";
final String digestOut = "e2761f51152f6663911e567901596707";
- final String fo =
- "<fo:root xmlns:fo='http://www.w3.org/1999/XSL/Format'>"
+ final String fo
+ = "<fo:root xmlns:fo='http://www.w3.org/1999/XSL/Format'>"
+ " <fo:layout-master-set>"
+ " <fo:simple-page-master master-name='simple'"
+ " page-height='25cm' page-width='20cm'>"
@@ -118,8 +119,8 @@ public final class GenericFOPTestCase extends TestCase {
FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
foUserAgent.setCreationDate(new Date(10000));
MessageDigest outDigest = MessageDigest.getInstance("MD5");
- DigestOutputStream out =
- new DigestOutputStream(new ByteArrayOutputStream(), outDigest);
+ DigestOutputStream out
+ = new DigestOutputStream(new ByteArrayOutputStream(), outDigest);
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out);
InputSource source = new InputSource(new StringReader(fo));
DigestFilter filter = new DigestFilter("MD5");
diff --git a/test/java/org/apache/fop/StandardTestSuite.java b/test/java/org/apache/fop/StandardTestSuite.java
index 281301789..caf75b4b4 100644
--- a/test/java/org/apache/fop/StandardTestSuite.java
+++ b/test/java/org/apache/fop/StandardTestSuite.java
@@ -23,7 +23,6 @@ import junit.framework.Test;
import junit.framework.TestSuite;
import org.apache.fop.fonts.DejaVuLGCSerifTest;
-import org.apache.fop.fonts.TrueTypeAnsiTestCase;
import org.apache.fop.image.loader.batik.ImageLoaderTestCase;
import org.apache.fop.image.loader.batik.ImagePreloaderTestCase;
import org.apache.fop.intermediate.IFMimickingTestCase;
@@ -54,7 +53,6 @@ public class StandardTestSuite {
suite.addTest(new TestSuite(PDFEncodingTestCase.class));
suite.addTest(new TestSuite(PDFCMapTestCase.class));
suite.addTest(new TestSuite(PDFsRGBSettingsTestCase.class));
- suite.addTest(new TestSuite(TrueTypeAnsiTestCase.class));
suite.addTest(new TestSuite(DejaVuLGCSerifTest.class));
suite.addTest(RichTextFormatTestSuite.suite());
suite.addTest(new TestSuite(ImageLoaderTestCase.class));
diff --git a/test/java/org/apache/fop/URIResolutionTestCase.java b/test/java/org/apache/fop/URIResolutionTestCase.java
index fd4f879da..0a197722b 100644
--- a/test/java/org/apache/fop/URIResolutionTestCase.java
+++ b/test/java/org/apache/fop/URIResolutionTestCase.java
@@ -92,7 +92,7 @@ public class URIResolutionTestCase extends AbstractFOPTestCase {
MyURIResolver resolver = new MyURIResolver(withStream);
ua.setURIResolver(resolver);
- ua.setBaseURL(foFile.getParentFile().toURL().toString());
+ ua.setBaseURL(foFile.getParentFile().toURI().toURL().toString());
Document doc = createAreaTree(foFile, ua);
@@ -119,7 +119,7 @@ public class URIResolutionTestCase extends AbstractFOPTestCase {
FOUserAgent ua = fopFactory.newFOUserAgent();
MyURIResolver resolver = new MyURIResolver(false);
ua.setURIResolver(resolver);
- ua.setBaseURL(foFile.getParentFile().toURL().toString());
+ ua.setBaseURL(foFile.getParentFile().toURI().toURL().toString());
ByteArrayOutputStream baout = new ByteArrayOutputStream();
diff --git a/test/java/org/apache/fop/config/BaseUserConfigTestCase.java b/test/java/org/apache/fop/config/BaseUserConfigTestCase.java
index 5c803317e..6ce833312 100644
--- a/test/java/org/apache/fop/config/BaseUserConfigTestCase.java
+++ b/test/java/org/apache/fop/config/BaseUserConfigTestCase.java
@@ -100,7 +100,7 @@ public abstract class BaseUserConfigTestCase extends BasePDFTestCase {
/**
* @return user config File
*/
- abstract protected String getUserConfigFilename();
+ protected abstract String getUserConfigFilename();
/*
* @see junit.framework.TestCase#getName()
diff --git a/test/java/org/apache/fop/events/EventChecker.java b/test/java/org/apache/fop/events/EventChecker.java
index 767c590ed..afef11d87 100644
--- a/test/java/org/apache/fop/events/EventChecker.java
+++ b/test/java/org/apache/fop/events/EventChecker.java
@@ -40,7 +40,7 @@ class EventChecker extends Assert implements EventListener {
if (event.getEventID().equals(expectedEventID)) {
eventReceived = true;
} else {
- fail("Unexpected event: id = " + event.getEventID() + ": "+ msg);
+ fail("Unexpected event: id = " + event.getEventID() + ": " + msg);
}
}
diff --git a/test/java/org/apache/fop/fonts/EncodingModeTest.java b/test/java/org/apache/fop/fonts/EncodingModeTest.java
new file mode 100644
index 000000000..4e81c46d6
--- /dev/null
+++ b/test/java/org/apache/fop/fonts/EncodingModeTest.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.fonts;
+
+import junit.framework.TestCase;
+
+public class EncodingModeTest extends TestCase {
+ public void testGetName() {
+ assertEquals("auto", EncodingMode.AUTO.getName());
+ assertEquals("single-byte", EncodingMode.SINGLE_BYTE.getName());
+ assertEquals("cid", EncodingMode.CID.getName());
+ }
+
+ public void testGetValue() {
+ assertEquals(EncodingMode.AUTO, EncodingMode.getEncodingMode("auto"));
+ assertEquals(EncodingMode.SINGLE_BYTE, EncodingMode.getEncodingMode("single-byte"));
+ assertEquals(EncodingMode.CID, EncodingMode.getEncodingMode("cid"));
+ }
+}
diff --git a/test/java/org/apache/fop/fonts/TrueTypeAnsiTestCase.java b/test/java/org/apache/fop/fonts/TrueTypeAnsiTestCase.java
deleted file mode 100644
index 3f98c93f4..000000000
--- a/test/java/org/apache/fop/fonts/TrueTypeAnsiTestCase.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* $Id$ */
-
-package org.apache.fop.fonts;
-
-import java.io.File;
-import java.io.OutputStream;
-import java.io.StringReader;
-import java.net.URL;
-import java.util.List;
-
-import javax.xml.transform.Result;
-import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.sax.SAXResult;
-import javax.xml.transform.stream.StreamSource;
-
-import junit.framework.TestCase;
-
-import org.apache.commons.io.output.NullOutputStream;
-
-import org.apache.fop.apps.FOUserAgent;
-import org.apache.fop.apps.Fop;
-import org.apache.fop.apps.FopFactory;
-import org.apache.fop.fonts.apps.TTFReader;
-import org.apache.fop.render.pdf.PDFRenderer;
-
-/**
- * Tests XML font metrics file generation and usage for WinAnsi mode.
- */
-public class TrueTypeAnsiTestCase extends TestCase {
-
- /**
- * Tests a TrueType font in WinAnsi mode.
- * @throws Exception if an error occurs
- */
- public void testTrueTypeAnsi() throws Exception {
- String fontFamily = "Gladiator Bold";
- File ttfFile = new File("./test/resources/fonts/glb12.ttf");
- File workDir = new File("./build/test-results");
- if (!workDir.isDirectory()) {
- assertTrue(workDir.mkdirs());
- }
- File metricsFile = new File(workDir, ttfFile.getName() + ".xml");
- if (metricsFile.isFile()) {
- assertTrue(metricsFile.delete());
- }
-
- String[] args = new String[] {"-enc", "ansi",
- ttfFile.getCanonicalPath(), metricsFile.getCanonicalPath()};
- TTFReader.main(args);
- assertTrue(metricsFile.isFile());
-
- FopFactory fopFactory = FopFactory.newInstance();
- FOUserAgent ua = fopFactory.newFOUserAgent();
- PDFRenderer renderer = new PDFRenderer();
- renderer.setUserAgent(ua);
- List fontList = new java.util.ArrayList();
- List triplets = new java.util.ArrayList();
- triplets.add(new FontTriplet(fontFamily, "normal", Font.WEIGHT_NORMAL));
- EmbedFontInfo font = new EmbedFontInfo(
- metricsFile.toURI().toASCIIString(),
- true, triplets,
- ttfFile.toURI().toASCIIString(), null);
- fontList.add(font);
- renderer.addFontList(fontList);
-
- ua.setRendererOverride(renderer);
- OutputStream out = new NullOutputStream();
-
- Fop fop = fopFactory.newFop(null, ua, out);
-
- TransformerFactory tFactory = TransformerFactory.newInstance();
- Source src = new StreamSource(new StringReader(
- "<root font-family='" + fontFamily + "'>Test!</root>"));
- Result res = new SAXResult(fop.getDefaultHandler());
- Transformer transformer = tFactory.newTransformer(
- getSourceForResource(this, "fonttest.xsl"));
- transformer.transform(src, res);
- }
-
- private static Source getSourceForResource(Object reference, String name) {
- URL url = reference.getClass().getResource(name);
- if (url == null) {
- throw new NullPointerException("Resource not found: " + name);
- }
- return new StreamSource(url.toExternalForm());
- }
-
-}
diff --git a/test/java/org/apache/fop/fonts/fonttest.xsl b/test/java/org/apache/fop/fonts/fonttest.xsl
deleted file mode 100644
index 26c7d72a5..000000000
--- a/test/java/org/apache/fop/fonts/fonttest.xsl
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:fo="http://www.w3.org/1999/XSL/Format">
-
- <xsl:output method="xml" indent="yes"/>
-
- <xsl:template match="root">
- <fo:root>
- <fo:layout-master-set>
- <fo:simple-page-master master-name="A4" page-height="29.7cm" page-width="21cm"
- margin="2cm">
- <fo:region-body/>
- </fo:simple-page-master>
- </fo:layout-master-set>
- <fo:page-sequence master-reference="A4">
- <fo:flow flow-name="xsl-region-body">
- <fo:block font-family="{@font-family}">
- <xsl:value-of select="."/>
- </fo:block>
- </fo:flow>
- </fo:page-sequence>
- </fo:root>
- </xsl:template>
-</xsl:stylesheet>
diff --git a/test/java/org/apache/fop/fotreetest/FOTreeUnitTester.java b/test/java/org/apache/fop/fotreetest/FOTreeUnitTester.java
index bfe9018b1..5513a89ab 100644
--- a/test/java/org/apache/fop/fotreetest/FOTreeUnitTester.java
+++ b/test/java/org/apache/fop/fotreetest/FOTreeUnitTester.java
@@ -94,6 +94,6 @@ public abstract class FOTreeUnitTester extends TestCase {
foReader.setErrorHandler(fop.getDefaultHandler());
foReader.setEntityResolver(fop.getDefaultHandler());
- foReader.parse(new File("test/fotree/unittests/" + filename).toURL().toExternalForm());
+ foReader.parse(new File("test/fotree/unittests/" + filename).toURI().toURL().toExternalForm());
}
}
diff --git a/test/java/org/apache/fop/fotreetest/ext/TestElementMapping.java b/test/java/org/apache/fop/fotreetest/ext/TestElementMapping.java
index 1d9127d0c..eee0efac4 100644
--- a/test/java/org/apache/fop/fotreetest/ext/TestElementMapping.java
+++ b/test/java/org/apache/fop/fotreetest/ext/TestElementMapping.java
@@ -40,7 +40,7 @@ public class TestElementMapping extends ElementMapping {
/** @see org.apache.fop.fo.ElementMapping#initialize() */
protected void initialize() {
if (foObjs == null) {
- foObjs = new java.util.HashMap();
+ foObjs = new java.util.HashMap<String, Maker>();
foObjs.put("assert", new AssertMaker());
}
}
diff --git a/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java b/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java
index d938a852b..2c0cf8504 100644
--- a/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java
+++ b/test/java/org/apache/fop/layoutengine/LayoutEngineTester.java
@@ -116,7 +116,7 @@ public class LayoutEngineTester {
//Setup FOP for area tree rendering
FOUserAgent ua = effFactory.newFOUserAgent();
- ua.setBaseURL(testFile.getParentFile().toURL().toString());
+ ua.setBaseURL(testFile.getParentFile().toURI().toURL().toString());
ua.getEventBroadcaster().addEventListener(
new ConsoleEventListenerForTests(testFile.getName(), EventSeverity.WARN));
diff --git a/test/java/org/apache/fop/memory/MemoryEater.java b/test/java/org/apache/fop/memory/MemoryEater.java
index a665580ae..337027dc4 100644
--- a/test/java/org/apache/fop/memory/MemoryEater.java
+++ b/test/java/org/apache/fop/memory/MemoryEater.java
@@ -79,7 +79,7 @@ public class MemoryEater {
OutputStream out = new NullOutputStream(); //write to /dev/nul
try {
FOUserAgent userAgent = fopFactory.newFOUserAgent();
- userAgent.setBaseURL(foFile.getParentFile().toURL().toExternalForm());
+ userAgent.setBaseURL(foFile.getParentFile().toURI().toURL().toExternalForm());
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, out);
Result res = new SAXResult(fop.getDefaultHandler());
diff --git a/test/java/org/apache/fop/memory/Stats.java b/test/java/org/apache/fop/memory/Stats.java
index 9e371251d..354952347 100644
--- a/test/java/org/apache/fop/memory/Stats.java
+++ b/test/java/org/apache/fop/memory/Stats.java
@@ -71,7 +71,7 @@ class Stats {
public void dumpFinalStats() {
long duration = System.currentTimeMillis() - startTime;
System.out.println("Final statistics");
- System.out.println("Pages produced: " +totalPagesProduced);
+ System.out.println("Pages produced: " + totalPagesProduced);
long ppm = 60000 * totalPagesProduced / duration;
System.out.println("Average speed: " + ppm + "ppm");
}
diff --git a/test/java/org/apache/fop/render/RendererFactoryTest.java b/test/java/org/apache/fop/render/RendererFactoryTest.java
index 4a40ac7c1..6b8e8f5f3 100644
--- a/test/java/org/apache/fop/render/RendererFactoryTest.java
+++ b/test/java/org/apache/fop/render/RendererFactoryTest.java
@@ -33,7 +33,6 @@ import org.apache.fop.render.intermediate.IFContext;
import org.apache.fop.render.intermediate.IFDocumentHandler;
import org.apache.fop.render.intermediate.IFRenderer;
import org.apache.fop.render.pdf.PDFDocumentHandler;
-import org.apache.fop.render.pdf.PDFRenderer;
import org.apache.fop.render.rtf.RTFHandler;
/**
@@ -73,29 +72,15 @@ public class RendererFactoryTest extends TestCase {
RendererFactory factory = fopFactory.getRendererFactory();
FOUserAgent ua;
Renderer renderer;
- Renderer overrideRenderer;
ua = fopFactory.newFOUserAgent();
renderer = factory.createRenderer(ua, MimeConstants.MIME_PDF);
assertTrue(renderer instanceof IFRenderer);
- factory.setRendererPreferred(true); //Test legacy setting
- ua = fopFactory.newFOUserAgent();
- renderer = factory.createRenderer(ua, MimeConstants.MIME_PDF);
- assertTrue(renderer instanceof PDFRenderer);
-
ua = fopFactory.newFOUserAgent();
renderer = factory.createRenderer(ua, MimeConstants.MIME_FOP_IF);
assertTrue(renderer instanceof IFRenderer);
- factory.setRendererPreferred(false);
- ua = fopFactory.newFOUserAgent();
- overrideRenderer = new PDFRenderer();
- overrideRenderer.setUserAgent(ua);
- ua.setRendererOverride(overrideRenderer);
- renderer = factory.createRenderer(ua, null);
- assertTrue(renderer == overrideRenderer);
-
ua = fopFactory.newFOUserAgent();
IFDocumentHandler overrideHandler;
overrideHandler = new PDFDocumentHandler();
diff --git a/test/java/org/apache/fop/render/pdf/PDFCMapTestCase.java b/test/java/org/apache/fop/render/pdf/PDFCMapTestCase.java
index f5d2f84cf..bd5c8ade1 100644
--- a/test/java/org/apache/fop/render/pdf/PDFCMapTestCase.java
+++ b/test/java/org/apache/fop/render/pdf/PDFCMapTestCase.java
@@ -27,38 +27,38 @@ import org.apache.fop.pdf.CMapBuilder;
/** Simple sanity test of the PDFCmap class */
public class PDFCMapTestCase extends TestCase {
+ private static final String EOL = "\n";
public void testPDFCMapFillInPDF() throws Exception {
- final String EOL = "\n";
- final String expected =
- "%!PS-Adobe-3.0 Resource-CMap" + EOL
- +"%%DocumentNeededResources: ProcSet (CIDInit)" + EOL
- +"%%IncludeResource: ProcSet (CIDInit)" + EOL
- +"%%BeginResource: CMap (test)" + EOL
- +"%%EndComments" + EOL
- +"/CIDInit /ProcSet findresource begin" + EOL
- +"12 dict begin" + EOL
- +"begincmap" + EOL
- +"/CIDSystemInfo 3 dict dup begin" + EOL
- +" /Registry (Adobe) def" + EOL
- +" /Ordering (Identity) def" + EOL
- +" /Supplement 0 def" + EOL
- +"end def" + EOL
- +"/CMapVersion 1 def" + EOL
- +"/CMapType 1 def" + EOL
- +"/CMapName /test def" + EOL
- +"1 begincodespacerange" + EOL
- +"<0000> <FFFF>" + EOL
- +"endcodespacerange" + EOL
- +"1 begincidrange" + EOL
- +"<0000> <FFFF> 0" + EOL
- +"endcidrange" + EOL
- +"endcmap" + EOL
- +"CMapName currentdict /CMap defineresource pop" + EOL
- +"end" + EOL
- +"end" + EOL
- +"%%EndResource" + EOL
- +"%%EOF" + EOL
+ final String expected
+ = "%!PS-Adobe-3.0 Resource-CMap" + EOL
+ + "%%DocumentNeededResources: ProcSet (CIDInit)" + EOL
+ + "%%IncludeResource: ProcSet (CIDInit)" + EOL
+ + "%%BeginResource: CMap (test)" + EOL
+ + "%%EndComments" + EOL
+ + "/CIDInit /ProcSet findresource begin" + EOL
+ + "12 dict begin" + EOL
+ + "begincmap" + EOL
+ + "/CIDSystemInfo 3 dict dup begin" + EOL
+ + " /Registry (Adobe) def" + EOL
+ + " /Ordering (Identity) def" + EOL
+ + " /Supplement 0 def" + EOL
+ + "end def" + EOL
+ + "/CMapVersion 1 def" + EOL
+ + "/CMapType 1 def" + EOL
+ + "/CMapName /test def" + EOL
+ + "1 begincodespacerange" + EOL
+ + "<0000> <FFFF>" + EOL
+ + "endcodespacerange" + EOL
+ + "1 begincidrange" + EOL
+ + "<0000> <FFFF> 0" + EOL
+ + "endcidrange" + EOL
+ + "endcmap" + EOL
+ + "CMapName currentdict /CMap defineresource pop" + EOL
+ + "end" + EOL
+ + "end" + EOL
+ + "%%EndResource" + EOL
+ + "%%EOF" + EOL
;
final StringWriter w = new StringWriter();
diff --git a/test/java/org/apache/fop/render/ps/ImageHandlingTestCase.java b/test/java/org/apache/fop/render/ps/ImageHandlingTestCase.java
index 7f0462a75..72c677a0c 100644
--- a/test/java/org/apache/fop/render/ps/ImageHandlingTestCase.java
+++ b/test/java/org/apache/fop/render/ps/ImageHandlingTestCase.java
@@ -43,52 +43,22 @@ import org.apache.fop.render.intermediate.IFContext;
public class ImageHandlingTestCase extends AbstractPostScriptTestCase {
/**
- * Tests JPEG handling with the {@link PSRenderer}.
+ * Tests JPEG handling.
* @throws Exception if an error occurs
*/
- public void testJPEGImageWithRendererLevel3() throws Exception {
- innerTestJPEGImageWithRenderer(3);
+ public void testJPEGImageLevel3() throws Exception {
+ innerTestJPEGImage(3);
}
/**
- * Tests JPEG handling with the {@link PSRenderer}.
+ * Tests JPEG handling.
* @throws Exception if an error occurs
*/
- public void testJPEGImageWithRendererLevel2() throws Exception {
- innerTestJPEGImageWithRenderer(2);
+ public void testJPEGImageLevel2() throws Exception {
+ innerTestJPEGImage(2);
}
- /**
- * Tests JPEG handling with the {@link PSDocumentHandler}.
- * @throws Exception if an error occurs
- */
- public void testJPEGImageWithIFLevel3() throws Exception {
- innerTestJPEGImageWithIF(3);
- }
-
- /**
- * Tests JPEG handling with the {@link PSDocumentHandler}.
- * @throws Exception if an error occurs
- */
- public void testJPEGImageWithIFLevel2() throws Exception {
- innerTestJPEGImageWithIF(2);
- }
-
- private void innerTestJPEGImageWithRenderer(int level) throws Exception {
- FOUserAgent ua = fopFactory.newFOUserAgent();
- PSRenderer renderer = new PSRenderer();
- renderer.setUserAgent(ua);
- PSRenderingUtil psUtil = renderer.getPSUtil();
- psUtil.setLanguageLevel(level);
- psUtil.setOptimizeResources(true);
- ua.setRendererOverride(renderer);
-
- // Prepare output file
- File outputFile = renderFile(ua, "ps-jpeg-image.fo", "-rend-l" + psUtil.getLanguageLevel());
- verifyPostScriptFile(outputFile, psUtil.getLanguageLevel());
- }
-
- private void innerTestJPEGImageWithIF(int level) throws Exception {
+ private void innerTestJPEGImage(int level) throws Exception {
FOUserAgent ua = fopFactory.newFOUserAgent();
PSDocumentHandler handler = new PSDocumentHandler();
handler.setContext(new IFContext(ua));
@@ -159,10 +129,6 @@ public class ImageHandlingTestCase extends AbstractPostScriptTestCase {
}
}
- private void assertMatches(String text, String regex) {
- assertTrue("Text didn't match '" + regex + "'", text.matches(regex));
- }
-
private void assertContains(String text, String searchString) {
assertTrue("Text doesn't contain '" + searchString + "'", text.indexOf(searchString) >= 0);
}
diff --git a/test/java/org/apache/fop/render/ps/ResourceOptimizationTestCase.java b/test/java/org/apache/fop/render/ps/ResourceOptimizationTestCase.java
index e5b9a4d27..862ad5205 100644
--- a/test/java/org/apache/fop/render/ps/ResourceOptimizationTestCase.java
+++ b/test/java/org/apache/fop/render/ps/ResourceOptimizationTestCase.java
@@ -54,28 +54,10 @@ import org.apache.fop.render.intermediate.IFContext;
public class ResourceOptimizationTestCase extends AbstractPostScriptTestCase {
/**
- * Tests resource optimization with the {@link PSRenderer}.
+ * Tests resource optimization.
* @throws Exception if an error occurs
*/
- public void testResourceOptimizationWithRenderer() throws Exception {
- FOUserAgent ua = fopFactory.newFOUserAgent();
- PSRenderer renderer = new PSRenderer();
- renderer.setUserAgent(ua);
- // This is the important part: we're enabling resource optimization
- renderer.getPSUtil().setOptimizeResources(true);
- ua.setRendererOverride(renderer);
-
- // Prepare output file
- File outputFile = renderFile(ua, "ps-resources.fo",
- "-rend-l" + renderer.getPSUtil().getLanguageLevel());
- verifyPostScriptFile(outputFile);
- }
-
- /**
- * Tests resource optimization with the {@link PSDocumentHandler}.
- * @throws Exception if an error occurs
- */
- public void testResourceOptimizationWithIF() throws Exception {
+ public void testResourceOptimization() throws Exception {
FOUserAgent ua = fopFactory.newFOUserAgent();
PSDocumentHandler handler = new PSDocumentHandler();
handler.setContext(new IFContext(ua));
diff --git a/test/java/org/apache/fop/text/linebreak/LineBreakStatusTest.java b/test/java/org/apache/fop/text/linebreak/LineBreakStatusTest.java
index 8d2936127..e9b2ff90d 100644
--- a/test/java/org/apache/fop/text/linebreak/LineBreakStatusTest.java
+++ b/test/java/org/apache/fop/text/linebreak/LineBreakStatusTest.java
@@ -320,6 +320,12 @@ public class LineBreakStatusTest extends TestCase {
"^^^^^^" + "^" + "_^^^^"
));
+ // Unassigned codepoint: should yield same result as AL
+ assertTrue(testBreak(
+ "No" + "\u1F7E" + "break",
+ "^^" + "^" + "^^^^^"
+ ));
+
}
/**
diff --git a/test/java/org/apache/fop/text/linebreak/LineBreakUtilsTest.java b/test/java/org/apache/fop/text/linebreak/LineBreakUtilsTest.java
index 31ad950c7..bb6d209c2 100644
--- a/test/java/org/apache/fop/text/linebreak/LineBreakUtilsTest.java
+++ b/test/java/org/apache/fop/text/linebreak/LineBreakUtilsTest.java
@@ -41,6 +41,7 @@ public class LineBreakUtilsTest extends TestCase {
assertEquals(LineBreakUtils.getLineBreakProperty('\n'), LineBreakUtils.LINE_BREAK_PROPERTY_LF);
assertEquals(LineBreakUtils.getLineBreakProperty('\r'), LineBreakUtils.LINE_BREAK_PROPERTY_CR);
assertEquals(LineBreakUtils.getLineBreakProperty('('), LineBreakUtils.LINE_BREAK_PROPERTY_OP);
+ assertEquals(LineBreakUtils.getLineBreakProperty('\u1F7E'), 0);
}
public void testLineBreakPair() {
diff --git a/test/java/org/apache/fop/traits/BorderPropsTestCase.java b/test/java/org/apache/fop/traits/BorderPropsTestCase.java
index 8ca097985..6eb41daac 100644
--- a/test/java/org/apache/fop/traits/BorderPropsTestCase.java
+++ b/test/java/org/apache/fop/traits/BorderPropsTestCase.java
@@ -23,6 +23,7 @@ import java.awt.Color;
import junit.framework.TestCase;
+import org.apache.xmlgraphics.java2d.color.ColorSpaces;
import org.apache.xmlgraphics.java2d.color.DeviceCMYKColorSpace;
import org.apache.fop.fo.Constants;
diff --git a/test/java/org/apache/fop/util/DigestFilter.java b/test/java/org/apache/fop/util/DigestFilter.java
index 0384b42df..94e8d67d2 100644
--- a/test/java/org/apache/fop/util/DigestFilter.java
+++ b/test/java/org/apache/fop/util/DigestFilter.java
@@ -43,7 +43,7 @@ import org.xml.sax.helpers.XMLFilterImpl;
public class DigestFilter extends XMLFilterImpl {
private MessageDigest digest;
- private byte value[];
+ private byte[] value;
private boolean isNamespaceAware;
public DigestFilter(String algorithm) throws NoSuchAlgorithmException {
@@ -133,7 +133,7 @@ public class DigestFilter extends XMLFilterImpl {
*/
public void setFeature(String feature, boolean value)
throws SAXNotRecognizedException, SAXNotSupportedException {
- if(feature.equals("http://xml.org/sax/features/namespaces")) {
+ if (feature.equals("http://xml.org/sax/features/namespaces")) {
isNamespaceAware = value;
}
super.setFeature(feature, value);
diff --git a/test/java/org/apache/fop/visual/AbstractPSPDFBitmapProducer.java b/test/java/org/apache/fop/visual/AbstractPSPDFBitmapProducer.java
index 0d976219d..678e80e7d 100644
--- a/test/java/org/apache/fop/visual/AbstractPSPDFBitmapProducer.java
+++ b/test/java/org/apache/fop/visual/AbstractPSPDFBitmapProducer.java
@@ -122,7 +122,7 @@ public abstract class AbstractPSPDFBitmapProducer extends AbstractBitmapProducer
try {
FOUserAgent userAgent = fopFactory.newFOUserAgent();
userAgent.setTargetResolution(context.getTargetResolution());
- userAgent.setBaseURL(src.getParentFile().toURL().toString());
+ userAgent.setBaseURL(src.getParentFile().toURI().toURL().toString());
File tempOut = new File(context.getTargetDir(),
src.getName() + "." + index + "." + getTargetExtension());
diff --git a/test/java/org/apache/fop/visual/BitmapProducerJava2D.java b/test/java/org/apache/fop/visual/BitmapProducerJava2D.java
index bd78fd93f..997a75931 100644
--- a/test/java/org/apache/fop/visual/BitmapProducerJava2D.java
+++ b/test/java/org/apache/fop/visual/BitmapProducerJava2D.java
@@ -70,7 +70,7 @@ public class BitmapProducerJava2D extends AbstractBitmapProducer implements Conf
try {
FOUserAgent userAgent = fopFactory.newFOUserAgent();
userAgent.setTargetResolution(context.getTargetResolution());
- userAgent.setBaseURL(src.getParentFile().toURL().toString());
+ userAgent.setBaseURL(src.getParentFile().toURI().toURL().toString());
File outputFile = new File(context.getTargetDir(),
src.getName() + "." + index + ".java2d.png");