* @return the value of the Lang entry (<code>null</code> if no language was specified)
*/
public String getLanguage() {
- return (String)get("Lang");
+ return (String) get("Lang");
+ }
+
+ @Override
- protected void writeDictionary(OutputStream out, Writer writer) throws IOException {
++ protected void writeDictionary(OutputStream out, StringBuilder textBuffer) throws IOException {
+ attachKids();
- super.writeDictionary(out, writer);
++ super.writeDictionary(out, textBuffer);
}
- public void outputInline(OutputStream out, Writer writer) throws IOException {
+
+ /**
+ * Attaches all valid kids to the kids array.
+ *
+ * @return true iff 1+ kids were added to the kids array
+ */
+ protected boolean attachKids() {
+ List<PDFObject> validKids = new ArrayList<PDFObject>();
+ if (kids != null) {
+ for (PDFObject kid : kids) {
+ if (kid instanceof Placeholder) {
+ if (((Placeholder) kid).attachKids()) {
+ validKids.add(kid);
+ }
+ } else {
+ validKids.add(kid);
+ }
+ }
+ }
+ boolean kidsAttached = !validKids.isEmpty();
+ if (kidsAttached) {
+ PDFArray array = new PDFArray();
+ for (PDFObject ob : validKids) {
+ array.add(ob);
+ }
+ put("K", array);
+ }
+ return kidsAttached;
+ }
+
+ /**
+ * Class representing a placeholder for a PDF Structure Element.
+ */
+ public static class Placeholder extends PDFStructElem {
+
+ @Override
- writer.write(' ');
++ public void outputInline(OutputStream out, StringBuilder textBuffer) throws IOException {
+ if (kids != null) {
+ assert kids.size() > 0;
+ for (int i = 0; i < kids.size(); i++) {
+ if (i > 0) {
- formatObject(obj, out, writer);
++ textBuffer.append(' ');
+ }
+ Object obj = kids.get(i);
++ formatObject(obj, out, textBuffer);
+ }
+ }
+ }
+
+ /**
+ * Constructor
+ * @param parent -
+ * @param name -
+ */
+ public Placeholder(PDFObject parent, String name) {
+ super(parent, new PDFName(name));
+ }
+ }
+
}
/** If not null, the XMLRenderer will mimic another renderer by using its font setup. */
protected Renderer mimic;
- private int pageSequenceIndex;
-
/**
- * Creates a new XML renderer.
+ * @param userAgent the user agent that contains configuration details. This cannot be null.
*/
- public XMLRenderer() {
+ public XMLRenderer(FOUserAgent userAgent) {
+ super(userAgent);
context = new RendererContext(this, XML_MIME_TYPE);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void setUserAgent(FOUserAgent agent) {
- super.setUserAgent(agent);
-
XMLHandler xmlHandler = new XMLXMLHandler();
userAgent.getXMLHandlerRegistry().addXMLHandler(xmlHandler);
Boolean b = (Boolean)userAgent.getRendererOptions().get("compact-format");
documents. Example: the fix of marks layering will be such a case when it's done.
-->
<release version="FOP Trunk" date="TBD">
++ <action context="Code" dev="PH" type="add" due-to="VH and PH">
++ Improvements of the Accessibility feature
++ </action>
+ <action context="Code" dev="CB" type="add" fixes-bug="52416" due-to="Luis Bernardo">
+ Suppress unnecessary "font not found warnings" when generating AFP with raster fonts
+ </action>
+ <action context="Code" dev="CB" type="add" fixes-bug="51209" due-to="Luis Bernardo">
+ SVG text in AFP creates miscoded GOCA text
+ </action>
+ <action context="Code" dev="CB" type="add" fixes-bug="50391" due-to="Peter Hancock">
+ Add support for different flow-name of fo:region-body in FOP
+ </action>
+ <action context="Code" dev="CB" type="add" fixes-bug="51664" due-to="Mehdi Houshmand">
+ Tagged PDF performance improvement plus tests
+ </action>
+ <action context="Code" dev="MH" type="add" fixes-bug="52197">
+ Improved AdobeStandardEncoding support in AFM files for type1 fonts
+ </action>
+ <action context="Code" dev="VH" type="add" fixes-bug="52151" due-to="Mehdi Houshmand">
+ Added ant script to get JaCoCo code coverage.
+ </action>
+ <action context="Code" dev="VH" type="add" fixes-bug="52136" due-to="Mehdi Houshmand">
+ Added to build file JUnit target that uses a regex to run all of the test cases. This
+ reduces the risk that some of them are omitted when building FOP.
+ </action>
+ <action context="Code" dev="PH" type="add" fixes-bug="52089" due-to="JM, Mehdi Houshmand">
+ Allow JPEG images to be embedded in an AFP document as is, without being decoded and
+ encoded.
+ </action>
<action context="Code" dev="PH" type="add" fixes-bug="52010" due-to="Mehdi Houshmand">
Simplification of the build: Reduced code duplication and layout engine tests.
</action>
*/
@RunWith(Suite.class)
@SuiteClasses({
- BasicDriverTestSuite.class,
- UtilityCodeTestSuite.class,
- PDFAConformanceTestCase.class,
- PDFEncodingTestCase.class,
- PDFCMapTestCase.class,
- PDFsRGBSettingsTestCase.class,
- DejaVuLGCSerifTest.class,
- RichTextFormatTestSuite.class,
- ImageLoaderTestCase.class,
- ImagePreloaderTestCase.class,
- IFMimickingTestCase.class,
- PageBoundariesTest.class,
- PageScaleTest.class,
- org.apache.fop.afp.AFPTestSuite.class,
- GlyfTableTestCase.class,
- ViewportTestSuite.class,
- RenderPDFTestSuite.class,
- MODCAParserTestCase.class,
- CharactersetEncoderTest.class,
- org.apache.fop.render.afp.AFPTestSuite.class,
- PSTestSuite.class,
- MinOptMaxTest.class,
- org.apache.fop.render.intermediate.IFStructureTreeBuilderTestCase.class
+ BasicDriverTestSuite.class,
+ UtilityCodeTestSuite.class,
+ PDFAConformanceTestCase.class,
+ PDFEncodingTestCase.class,
+ PDFCMapTestCase.class,
+ PDFsRGBSettingsTestCase.class,
+ DejaVuLGCSerifTestCase.class,
+ RichTextFormatTestSuite.class,
+ ImageLoaderTestCase.class,
+ ImagePreloaderTestCase.class,
+ IFMimickingTestCase.class,
+ PageBoundariesTestCase.class,
+ PageScaleTestCase.class,
+ org.apache.fop.afp.AFPTestSuite.class,
+ GlyfTableTestCase.class,
+ ViewportTestSuite.class,
+ RenderPDFTestSuite.class,
+ MODCAParserTestCase.class,
+ CharactersetEncoderTestCase.class,
+ org.apache.fop.render.afp.AFPTestSuite.class,
+ PDFLibraryTestSuite.class,
+ PSTestSuite.class,
+ MinOptMaxTestCase.class,
+ AdobeStandardEncodingTestCase.class,
+ AFMParserTestCase.class,
- FontEventProcessingTestCase.class
++ FontEventProcessingTestCase.class,
++ org.apache.fop.render.intermediate.IFStructureTreeBuilderTestCase.class
})
public class StandardTestSuite {
}
--- /dev/null
- import org.apache.fop.fotreetest.FOTreeUnitTester;
+/*
+ * 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.fo.flow.table;
+
++import java.io.FileInputStream;
+import java.util.Iterator;
+
+import org.apache.fop.apps.FOUserAgent;
++import org.apache.fop.fo.FODocumentParser;
+import org.apache.fop.fo.FOEventHandler;
- abstract class AbstractTableTest extends FOTreeUnitTester {
++import org.apache.fop.fo.FODocumentParser.FOEventHandlerFactory;
++import org.apache.fop.util.ConsoleEventListenerForTests;
+
+/**
+ * Superclass for testcases related to tables, factoring the common stuff.
+ */
- private FOTreeUnitTester.FOEventHandlerFactory tableHandlerFactory;
++abstract class AbstractTableTest {
+
- public AbstractTableTest() throws Exception {
- super();
- tableHandlerFactory = new FOEventHandlerFactory() {
- public FOEventHandler createFOEventHandler(FOUserAgent foUserAgent) {
++ private FODocumentParser documentParser;
+
+ private TableHandler tableHandler;
+
- };
- }
-
- protected void setUp(String filename) throws Exception {
- setUp(filename, tableHandlerFactory);
++ protected void setUp(String filename) throws Exception {
++ createDocumentParser();
++ documentParser.setEventListener(new ConsoleEventListenerForTests(filename));
++ documentParser.parse(new FileInputStream("test/fotree/unittests/" + filename));
++ }
++
++ private void createDocumentParser() {
++ documentParser = FODocumentParser.newInstance(new FOEventHandlerFactory() {
++ public FOEventHandler newFOEventHandler(FOUserAgent foUserAgent) {
+ tableHandler = new TableHandler(foUserAgent);
+ return tableHandler;
+ }
++ });
+ }
+
+ protected TableHandler getTableHandler() {
+ return tableHandler;
+ }
+
+ protected Iterator getTableIterator() {
+ return tableHandler.getTables().iterator();
+ }
+}
--- /dev/null
- public ErrorCheckTest() throws Exception {
- super();
- }
-
+/*
+ * 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.fo.flow.table;
+
++import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
++import org.apache.fop.fo.LoadingException;
+import org.apache.fop.fo.ValidationException;
+
+/**
+ * Abstract class for testing erroneous files, checking that a ValidationException is thrown.
+ */
+abstract class ErrorCheckTest extends AbstractTableTest {
+
- fail();
- } catch (ValidationException e) {
+ protected void launchTest(String filename) throws Exception {
+ try {
+ setUp(filename);
++ fail("Expected ValidationException to be thrown");
++ } catch (LoadingException e) {
+ // TODO check location
++ assertTrue(e.getCause() instanceof ValidationException);
+ }
+ }
+
+}
* Testcase checking that cells spanning further than their parent element aren't
* accepted.
*/
-public class IllegalRowSpanTestCase extends ErrorCheckTestCase {
+public class IllegalRowSpanTestCase extends ErrorCheckTest {
- public IllegalRowSpanTestCase() throws Exception {
- super();
- }
-
@Test
public void testBody1() throws Exception {
launchTest("table/illegal-row-span_body_1.fo");
* Tests that RowGroupBuilder returns, for each part of a table, the expected number of
* row-groups with the expected number or rows in each.
*/
-public class RowGroupBuilderTestCase extends AbstractTableTestCase {
+public class RowGroupBuilderTestCase extends AbstractTableTest {
- public RowGroupBuilderTestCase() throws Exception {
- super();
- }
-
/**
* Checks that the given table-body(header,footer) will return row groups as expected.
* More precisely, checks that the number of row groups corresponds to the size of the
import java.util.Iterator;
+ import org.junit.Test;
+
import org.apache.fop.datatypes.PercentBaseContext;
import org.apache.fop.fo.FObj;
- import org.junit.Test;
-public class TableColumnColumnNumberTestCase extends AbstractTableTestCase {
+public class TableColumnColumnNumberTestCase extends AbstractTableTest {
/**
* A percentBaseContext that mimics the behaviour of TableLM for computing the widths
import org.junit.Test;
-public class TooManyColumnsTestCase extends ErrorCheckTestCase {
+public class TooManyColumnsTestCase extends ErrorCheckTest {
- public TooManyColumnsTestCase() throws Exception {
- super();
- }
-
@Test
public void testBody1() throws Exception {
launchTest("table/too-many-columns_body_1.fo");
*/
@RunWith(Suite.class)
@Suite.SuiteClasses({
- TooManyColumnsTestCase.class,
- IllegalRowSpanTestCase.class,
- RowGroupBuilderTestCase.class,
- TableColumnColumnNumberTestCase.class,
- CollapsedConditionalBorderTestCase.class,
- FOTreeTester.class,
- org.apache.fop.fo.properties.CommonAccessibilityHolderTestCase.class,
- DelegatingFOEventHandlerTestCase.class
+ org.apache.fop.fo.flow.table.AllTests.class,
+ org.apache.fop.fo.pagination.AllTests.class,
- FOTreeTestCase.class })
-
++ org.apache.fop.fotreetest.FOTreeTestCase.class,
++ org.apache.fop.fo.properties.CommonAccessibilityHolderTestCase.class,
++ org.apache.fop.fo.DelegatingFOEventHandlerTestCase.class
+ })
public final class FOTreeTestSuite {
}
* Tests the intermediate format parser.
*/
@RunWith(Parameterized.class)
-public class IFParserTestCase extends AbstractIFTestCase {
+public class IFParserTestCase extends AbstractIFTest {
+ /** Set this to true to get the correspondence between test number and test file. */
+ private static final boolean DEBUG = false;
+
/**
* Gets the parameters for this test
*