diff options
author | Peter Hancock <phancock@apache.org> | 2012-08-16 13:31:38 +0000 |
---|---|---|
committer | Peter Hancock <phancock@apache.org> | 2012-08-16 13:31:38 +0000 |
commit | 80e1071780dacf1235c0f31bf20fe6c6df7ff8e8 (patch) | |
tree | 012a241ed426e2d10965ab402f04f84c9827b421 /test | |
parent | 3e96fb119fcbd9e6e0644092b0e2376bdbbe6c10 (diff) | |
parent | 726e1ef3093bedfd6671c2e6471e0d62ef605be5 (diff) | |
download | xmlgraphics-fop-80e1071780dacf1235c0f31bf20fe6c6df7ff8e8.tar.gz xmlgraphics-fop-80e1071780dacf1235c0f31bf20fe6c6df7ff8e8.zip |
Merged trunk@1373227
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_RoundedCorners@1373825 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test')
23 files changed, 964 insertions, 139 deletions
diff --git a/test/events/region-body_overflow.fo b/test/events/region-body_overflow.fo new file mode 100644 index 000000000..99b6dde68 --- /dev/null +++ b/test/events/region-body_overflow.fo @@ -0,0 +1,115 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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$ --> +<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <fo:layout-master-set> + <fo:simple-page-master master-name="page" + page-height="80pt" page-width="530pt" margin="10pt" margin-bottom="0"> + <fo:region-body margin-bottom="20pt" column-count="5" column-gap="10pt"/> + <fo:region-after extent="15pt"/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="page" font-size="8pt" line-height="10pt"> + <fo:static-content flow-name="xsl-region-after"> + <fo:block text-align="center"><fo:page-number/></fo:block> + </fo:static-content> + <fo:flow flow-name="xsl-region-body"> + + <fo:block>Page 1 Column 1 Line 1</fo:block> + <fo:block>Page 1 Column 1 Line 2</fo:block> + <fo:block>Page 1 Column 1 Line 3</fo:block> + <fo:block>Page 1 Column 1 Line 4</fo:block> + <fo:block>Page 1 Column 1 Line 5</fo:block> + <fo:block>Page 1 Column 2 Line 1</fo:block> + <fo:block>Page 1 Column 2 Line 2</fo:block> + <fo:block>Page 1 Column 2 Line 3</fo:block> + <fo:block>Page 1 Column 2 Line 4</fo:block> + <fo:block>Page 1 Column 2 Line 5</fo:block> + <fo:block>Page 1 Column 3 Line 1</fo:block> + <fo:block>Page 1 Column 3 Line 2</fo:block> + <fo:block>Page 1 Column 3 Line 3</fo:block> + <fo:block>Page 1 Column 3 Line 4</fo:block> + <fo:block>Page 1 Column 3 Line 5</fo:block> + <fo:block>Page 1 Column 4 Line 1</fo:block> + <fo:block>Page 1 Column 4 Line 2</fo:block> + <fo:block>Page 1 Column 4 Line 3</fo:block> + <fo:block>Page 1 Column 4 Line 4</fo:block> + <fo:block>Page 1 Column 4 Line 5</fo:block> + <fo:block-container height="55pt" background-color="#F0F0F0"> + <fo:block>Page 1 Column 5 Line 1</fo:block> + <fo:block>Page 1 Column 5 Line 2</fo:block> + <fo:block>Page 1 Column 5 Line 3</fo:block> + <fo:block>Page 1 Column 5 Line 4</fo:block> + <fo:block>Page 1 Column 5 Line 5</fo:block> + </fo:block-container> + + <fo:block break-before="page">Page 2 Column 1 Line 1</fo:block> + <fo:block>Page 2 Column 1 Line 2</fo:block> + <fo:block>Page 2 Column 1 Line 3</fo:block> + <fo:block>Page 2 Column 1 Line 4</fo:block> + <fo:block>Page 2 Column 1 Line 5</fo:block> + <fo:block>Page 2 Column 2 Line 1</fo:block> + <fo:block>Page 2 Column 2 Line 2</fo:block> + <fo:block>Page 2 Column 2 Line 3</fo:block> + <fo:block>Page 2 Column 2 Line 4</fo:block> + <fo:block>Page 2 Column 2 Line 5</fo:block> + <fo:block>Page 2 Column 3 Line 1</fo:block> + <fo:block>Page 2 Column 3 Line 2</fo:block> + <fo:block>Page 2 Column 3 Line 3</fo:block> + <fo:block>Page 2 Column 3 Line 4</fo:block> + <fo:block>Page 2 Column 3 Line 5</fo:block> + <fo:block>Page 2 Column 4 Line 1</fo:block> + <fo:block>Page 2 Column 4 Line 2</fo:block> + <fo:block>Page 2 Column 4 Line 3</fo:block> + <fo:block>Page 2 Column 4 Line 4</fo:block> + <fo:block>Page 2 Column 4 Line 5</fo:block> + <fo:block>Page 2 Column 5 Line 1</fo:block> + <fo:block>Page 2 Column 5 Line 2</fo:block> + <fo:block>Page 2 Column 5 Line 3</fo:block> + <fo:block>Page 2 Column 5 Line 4</fo:block> + <fo:block>Page 2 Column 5 Line 5</fo:block> + + <fo:block>Page 3 Column 1 Line 1</fo:block> + <fo:block>Page 3 Column 1 Line 2</fo:block> + <fo:block>Page 3 Column 1 Line 3</fo:block> + <fo:block>Page 3 Column 1 Line 4</fo:block> + <fo:block>Page 3 Column 1 Line 5</fo:block> + <fo:block>Page 3 Column 2 Line 1</fo:block> + <fo:block>Page 3 Column 2 Line 2</fo:block> + <fo:block>Page 3 Column 2 Line 3</fo:block> + <fo:block>Page 3 Column 2 Line 4</fo:block> + <fo:block>Page 3 Column 2 Line 5</fo:block> + <fo:block>Page 3 Column 3 Line 1</fo:block> + <fo:block>Page 3 Column 3 Line 2</fo:block> + <fo:block>Page 3 Column 3 Line 3</fo:block> + <fo:block>Page 3 Column 3 Line 4</fo:block> + <fo:block>Page 3 Column 3 Line 5</fo:block> + <fo:block>Page 3 Column 4 Line 1</fo:block> + <fo:block>Page 3 Column 4 Line 2</fo:block> + <fo:block>Page 3 Column 4 Line 3</fo:block> + <fo:block>Page 3 Column 4 Line 4</fo:block> + <fo:block>Page 3 Column 4 Line 5</fo:block> + <fo:block>Page 3 Column 5 Line 1</fo:block> + <fo:block>Page 3 Column 5 Line 2</fo:block> + <fo:block>Page 3 Column 5 Line 3</fo:block> + <fo:block>Page 3 Column 5 Line 4</fo:block> + <fo:block>Page 3 Column 5 Line 5</fo:block> + + </fo:flow> + </fo:page-sequence> +</fo:root> diff --git a/test/java/org/apache/fop/afp/AFPEventProcessingTestCase.java b/test/java/org/apache/fop/afp/AFPEventProcessingTestCase.java index 521deacea..d1b47846b 100644 --- a/test/java/org/apache/fop/afp/AFPEventProcessingTestCase.java +++ b/test/java/org/apache/fop/afp/AFPEventProcessingTestCase.java @@ -26,6 +26,7 @@ import org.junit.Test; import org.apache.xmlgraphics.util.MimeConstants; +import org.apache.fop.apps.FOPException; import org.apache.fop.events.EventProcessingTestCase; @@ -49,12 +50,12 @@ public class AFPEventProcessingTestCase { testInvalidConfigEvent("afp-font-missing.xconf", ".fontConfigMissing"); } - @Test + @Test(expected = FOPException.class) public void testInvalidCharactersetName() throws Exception { testInvalidConfigEvent("afp-invalid-characterset.xconf", ".characterSetNameInvalid"); } - @Test + @Test(expected = FOPException.class) public void testinvalidConfig() throws Exception { testInvalidConfigEvent("afp-invalid-config.xconf", ".invalidConfiguration"); } diff --git a/test/java/org/apache/fop/afp/util/AFPResourceAccessorTestCase.java b/test/java/org/apache/fop/afp/util/AFPResourceAccessorTestCase.java new file mode 100644 index 000000000..d729d336d --- /dev/null +++ b/test/java/org/apache/fop/afp/util/AFPResourceAccessorTestCase.java @@ -0,0 +1,84 @@ +/* + * 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. + */ + +package org.apache.fop.afp.util; + +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; + +import org.junit.Before; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + +import org.apache.fop.apps.io.InternalResourceResolver; + +public class AFPResourceAccessorTestCase { + + private InternalResourceResolver nullBaseResourceResolver; + private InternalResourceResolver absoluteBaseResourceResolver; + private InternalResourceResolver relativeBaseResourceResolver; + private final URI absoluteBaseURI = URI.create("this:///purely.for.testing"); + private final URI relativeBaseURI = URI.create("./this.is.purely.for.testing"); + private AFPResourceAccessor nullBaseURISut; + private AFPResourceAccessor absoluteBaseURISut; + private AFPResourceAccessor relativeBaseURISut; + + @Before + public void setUp() { + nullBaseResourceResolver = mock(InternalResourceResolver.class); + absoluteBaseResourceResolver = mock(InternalResourceResolver.class); + relativeBaseResourceResolver = mock(InternalResourceResolver.class); + nullBaseURISut = new AFPResourceAccessor(nullBaseResourceResolver); + absoluteBaseURISut = new AFPResourceAccessor(absoluteBaseResourceResolver, + absoluteBaseURI.toASCIIString()); + relativeBaseURISut = new AFPResourceAccessor(relativeBaseResourceResolver, + relativeBaseURI.toASCIIString()); + } + + @Test + public void testCreateInputStream() throws IOException, URISyntaxException { + URI testURI = URI.create("test"); + nullBaseURISut.createInputStream(testURI); + verify(nullBaseResourceResolver).getResource(testURI); + + absoluteBaseURISut.createInputStream(testURI); + verify(absoluteBaseResourceResolver).getResource(getActualURI(absoluteBaseURI, testURI)); + + relativeBaseURISut.createInputStream(testURI); + verify(relativeBaseResourceResolver).getResource(getActualURI(relativeBaseURI, testURI)); + } + + private URI getActualURI(URI baseURI, URI testURI) throws URISyntaxException { + return InternalResourceResolver.getBaseURI(baseURI.toASCIIString()).resolve(testURI); + } + + @Test + public void testResolveURI() throws URISyntaxException { + String testURI = "anotherTestURI"; + assertEquals(URI.create("./" + testURI), nullBaseURISut.resolveURI(testURI)); + + assertEquals(getActualURI(absoluteBaseURI, URI.create(testURI)), + absoluteBaseURISut.resolveURI(testURI)); + + assertEquals(getActualURI(relativeBaseURI, URI.create(testURI)), + relativeBaseURISut.resolveURI(testURI)); + } +} diff --git a/test/java/org/apache/fop/apps/FopConfBuilder.java b/test/java/org/apache/fop/apps/FopConfBuilder.java index 1efb2d698..8dd882d8a 100644 --- a/test/java/org/apache/fop/apps/FopConfBuilder.java +++ b/test/java/org/apache/fop/apps/FopConfBuilder.java @@ -113,7 +113,17 @@ public class FopConfBuilder implements FontConfigurator<FopConfBuilder> { /** * Set the <strict-validation> tag within the fop.xconf. * - * @param validateStrictly true to enforce strict validation + * @param validateStrictly true to enforce strict FO validation + * @return <b>this</b> + */ + public FopConfBuilder setStrictConfiguration(boolean validateStrictly) { + return createElement("strict-configuration", String.valueOf(validateStrictly)); + } + + /** + * Set the <strict-validation> tag within the fop.xconf. + * + * @param validateStrictly true to enforce strict configuration validation * @return <b>this</b> */ public FopConfBuilder setStrictValidation(boolean validateStrictly) { diff --git a/test/java/org/apache/fop/apps/FopConfParserTestCase.java b/test/java/org/apache/fop/apps/FopConfParserTestCase.java index 2fe939f76..3c2930942 100644 --- a/test/java/org/apache/fop/apps/FopConfParserTestCase.java +++ b/test/java/org/apache/fop/apps/FopConfParserTestCase.java @@ -75,8 +75,14 @@ public class FopConfParserTestCase { } @Test - public void testStrictUserConfigValidation() { + public void testStrictFOValidation() { builder.setStrictValidation(false); + assertFalse(buildFactory().validateStrictly()); + } + + @Test + public void testStrictUserValidation() { + builder.setStrictConfiguration(false); assertFalse(buildFactory().validateUserConfigStrictly()); } diff --git a/test/java/org/apache/fop/apps/FopFactoryBuilderTestCase.java b/test/java/org/apache/fop/apps/FopFactoryBuilderTestCase.java index f56373218..e504c4bc4 100644 --- a/test/java/org/apache/fop/apps/FopFactoryBuilderTestCase.java +++ b/test/java/org/apache/fop/apps/FopFactoryBuilderTestCase.java @@ -162,7 +162,7 @@ public class FopFactoryBuilderTestCase { public void run() { URI nonDefaultURI = URI.create("./test/"); defaultBuilder.setBaseURI(nonDefaultURI); - assertEquals(nonDefaultURI, defaultBuilder.buildConfig().getBaseURI()); + assertEquals(nonDefaultURI, defaultBuilder.buildConfiguration().getBaseURI()); } }); } diff --git a/test/java/org/apache/fop/config/SingleFopConfParseTestCase.java b/test/java/org/apache/fop/apps/FopFactoryTestCase.java index 430de318b..8ac21c994 100644 --- a/test/java/org/apache/fop/config/SingleFopConfParseTestCase.java +++ b/test/java/org/apache/fop/apps/FopFactoryTestCase.java @@ -17,16 +17,15 @@ /* $Id$ */ -package org.apache.fop.config; +package org.apache.fop.apps; import java.io.IOException; import org.junit.Test; import org.xml.sax.SAXException; -import org.apache.fop.apps.FopConfBuilder; import org.apache.fop.apps.MimeConstants; -import org.apache.fop.apps.PDFRendererConfBuilder; +import org.apache.fop.config.BaseConstructiveUserConfigTest; import org.apache.fop.render.RendererConfig.RendererConfigParser; import org.apache.fop.render.pdf.PDFRendererConfig; @@ -35,9 +34,9 @@ import static org.junit.Assert.fail; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class SingleFopConfParseTestCase extends BaseConstructiveUserConfigTest { +public class FopFactoryTestCase extends BaseConstructiveUserConfigTest { - public SingleFopConfParseTestCase() throws SAXException, IOException { + public FopFactoryTestCase() throws SAXException, IOException { super(new FopConfBuilder().setStrictValidation(true) .startRendererConfig(PDFRendererConfBuilder.class) .startFontsConfig() diff --git a/test/java/org/apache/fop/apps/MutableConfig.java b/test/java/org/apache/fop/apps/MutableConfig.java new file mode 100644 index 000000000..79f038f24 --- /dev/null +++ b/test/java/org/apache/fop/apps/MutableConfig.java @@ -0,0 +1,133 @@ +/* + * 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. + */ + +package org.apache.fop.apps; + +import java.net.URI; +import java.util.Map; +import java.util.Set; + +import org.apache.avalon.framework.configuration.Configuration; + +import org.apache.xmlgraphics.image.loader.ImageManager; + +import org.apache.fop.apps.io.ResourceResolver; +import org.apache.fop.fonts.FontManager; +import org.apache.fop.layoutmgr.LayoutManagerMaker; + +/** + * This is a mutable implementation of the {@link FopFactoryConfig} to be used for testing purposes. + * This is also an example of how to make the seemingly immutable {@link FopFactory} mutable should + * a client need to, though this is ill-advised. + */ +public final class MutableConfig implements FopFactoryConfig { + + private final FopFactoryConfig delegate; + + private boolean setBreakInheritance; + private float sourceResolution; + + public MutableConfig(FopFactoryBuilder factoryBuilder) { + delegate = factoryBuilder.buildConfiguration(); + setBreakInheritance = delegate.isBreakIndentInheritanceOnReferenceAreaBoundary(); + sourceResolution = delegate.getSourceResolution(); + } + + public boolean isAccessibilityEnabled() { + return delegate.isAccessibilityEnabled(); + } + + public LayoutManagerMaker getLayoutManagerMakerOverride() { + return delegate.getLayoutManagerMakerOverride(); + } + + public ResourceResolver getResourceResolver() { + return delegate.getResourceResolver(); + } + + public URI getBaseURI() { + return delegate.getBaseURI(); + } + + public boolean validateStrictly() { + return delegate.validateStrictly(); + } + + public boolean validateUserConfigStrictly() { + return delegate.validateUserConfigStrictly(); + } + + public boolean isBreakIndentInheritanceOnReferenceAreaBoundary() { + return setBreakInheritance; + } + + public void setBreakIndentInheritanceOnReferenceAreaBoundary(boolean value) { + setBreakInheritance = value; + } + + public float getSourceResolution() { + return sourceResolution; + } + + public void setSourceResolution(float srcRes) { + sourceResolution = srcRes; + } + + public float getTargetResolution() { + return delegate.getTargetResolution(); + } + + public String getPageHeight() { + return delegate.getPageHeight(); + } + + public String getPageWidth() { + return delegate.getPageWidth(); + } + + public Set<String> getIgnoredNamespaces() { + return delegate.getIgnoredNamespaces(); + } + + public boolean isNamespaceIgnored(String namespace) { + return delegate.isNamespaceIgnored(namespace); + } + + public Configuration getUserConfig() { + return delegate.getUserConfig(); + } + + public boolean preferRenderer() { + return delegate.preferRenderer(); + } + + public FontManager getFontManager() { + return delegate.getFontManager(); + } + + public ImageManager getImageManager() { + return delegate.getImageManager(); + } + + public boolean isComplexScriptFeaturesEnabled() { + return delegate.isComplexScriptFeaturesEnabled(); + } + + public Map<String, String> getHyphenationPatternNames() { + return delegate.getHyphenationPatternNames(); + } +} diff --git a/test/java/org/apache/fop/events/EventChecker.java b/test/java/org/apache/fop/events/EventChecker.java index dac67a8cc..3f0eef6bb 100644 --- a/test/java/org/apache/fop/events/EventChecker.java +++ b/test/java/org/apache/fop/events/EventChecker.java @@ -19,6 +19,9 @@ package org.apache.fop.events; +import java.util.Map; + +import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; /** @@ -28,10 +31,13 @@ class EventChecker implements EventListener { private final String expectedEventID; + private final Map<String, Object> expectedParams; + private boolean eventReceived; - EventChecker(String expectedEventID) { + EventChecker(String expectedEventID, Map<String, Object> expectedParams) { this.expectedEventID = expectedEventID; + this.expectedParams = expectedParams; } public void processEvent(Event event) { @@ -39,6 +45,9 @@ class EventChecker implements EventListener { String id = event.getEventID(); if (id.equals(expectedEventID)) { eventReceived = true; + for (Map.Entry<String, Object> param : expectedParams.entrySet()) { + assertEquals(event.getParam(param.getKey()), param.getValue()); + } } } diff --git a/test/java/org/apache/fop/events/EventProcessingTestCase.java b/test/java/org/apache/fop/events/EventProcessingTestCase.java index 9338fc01a..fb17c9c0c 100644 --- a/test/java/org/apache/fop/events/EventProcessingTestCase.java +++ b/test/java/org/apache/fop/events/EventProcessingTestCase.java @@ -22,6 +22,9 @@ package org.apache.fop.events; import java.io.File; import java.io.InputStream; import java.net.URI; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; import javax.xml.transform.Result; import javax.xml.transform.Source; @@ -62,9 +65,10 @@ public class EventProcessingTestCase { CONFIG_BASE_DIR = base.resolve("test/config/"); } - public void doTest(InputStream inStream, URI fopConf, String expectedEventID, String mimeType) - throws Exception { - EventChecker eventChecker = new EventChecker(expectedEventID); + + public void doTest(InputStream inStream, URI fopConf, String expectedEventID, String mimeType, + Map<String, Object> expectedParams) throws Exception { + EventChecker eventChecker = new EventChecker(expectedEventID, expectedParams); FopFactory fopFactory; if (fopConf != null) { fopFactory = FopFactory.newInstance(new File(fopConf)); @@ -81,6 +85,19 @@ public class EventProcessingTestCase { Result res = new SAXResult(fop.getDefaultHandler()); transformer.transform(src, res); eventChecker.end(); + + } + + public void doTest(InputStream inStream, URI fopConf, String expectedEventID, String mimeType) + throws Exception { + Map<String, Object> noParams = Collections.emptyMap(); + doTest(inStream, fopConf, expectedEventID, mimeType, noParams); + } + + public void doTest(String filename, String expectedEventID, Map<String, Object> expectedParams) + throws Exception { + doTest(BASE_DIR.resolve(filename).toURL().openStream(), null, expectedEventID, + MimeConstants.MIME_PDF, expectedParams); } public void doTest(String filename, String expectedEventID) throws Exception { @@ -133,4 +150,12 @@ public class EventProcessingTestCase { public void testViewportBPDOverflow() throws Exception { doTest("viewport-overflow.fo", BlockLevelEventProducer.class.getName() + ".viewportBPDOverflow"); } + + @Test + public void testPageOverflow() throws Exception { + Map<String, Object> params = new HashMap<String, Object>(); + params.put("page", "1"); + doTest("region-body_overflow.fo", BlockLevelEventProducer.class.getName() + ".regionOverflow", + params); + } } diff --git a/test/java/org/apache/fop/fotreetest/FOTreeTestCase.java b/test/java/org/apache/fop/fotreetest/FOTreeTestCase.java index ab6411b3a..3d58e7ef0 100644 --- a/test/java/org/apache/fop/fotreetest/FOTreeTestCase.java +++ b/test/java/org/apache/fop/fotreetest/FOTreeTestCase.java @@ -20,11 +20,8 @@ package org.apache.fop.fotreetest; import java.io.File; -import java.net.URI; import java.util.Collection; import java.util.List; -import java.util.Map; -import java.util.Set; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; @@ -38,22 +35,16 @@ import org.xml.sax.SAXException; import org.xml.sax.XMLReader; import org.xml.sax.helpers.XMLFilterImpl; -import org.apache.avalon.framework.configuration.Configuration; - -import org.apache.xmlgraphics.image.loader.ImageManager; - import org.apache.fop.DebugHelper; import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.Fop; import org.apache.fop.apps.FopFactory; import org.apache.fop.apps.FopFactoryBuilder; import org.apache.fop.apps.FopFactoryConfig; -import org.apache.fop.apps.io.ResourceResolver; -import org.apache.fop.fonts.FontManager; +import org.apache.fop.apps.MutableConfig; import org.apache.fop.fotreetest.ext.TestElementMapping; import org.apache.fop.layoutengine.LayoutEngineTestUtils; import org.apache.fop.layoutengine.TestFilesConfiguration; -import org.apache.fop.layoutmgr.LayoutManagerMaker; import org.apache.fop.util.ConsoleEventListenerForTests; /** @@ -123,7 +114,7 @@ public class FOTreeTestCase { FopFactoryConfig.DEFAULT_BREAK_INDENT_INHERITANCE); builder.setSourceResolution(FopFactoryConfig.DEFAULT_SOURCE_RESOLUTION); - MutableConfig mutableConfig = new MutableConfig(builder.buildConfig()); + MutableConfig mutableConfig = new MutableConfig(builder); FopFactory fopFactory = FopFactory.newInstance(mutableConfig); fopFactory.addElementMapping(new TestElementMapping()); @@ -181,102 +172,4 @@ public class FOTreeTestCase { super.processingInstruction(target, data); } } - - private static final class MutableConfig implements FopFactoryConfig { - - private final FopFactoryConfig delegate; - - private boolean setBreakInheritance; - private float sourceResolution; - - private MutableConfig(FopFactoryConfig wrappedConfig) { - delegate = wrappedConfig; - setBreakInheritance = delegate.isBreakIndentInheritanceOnReferenceAreaBoundary(); - sourceResolution = delegate.getSourceResolution(); - } - - public boolean isAccessibilityEnabled() { - return delegate.isAccessibilityEnabled(); - } - - public LayoutManagerMaker getLayoutManagerMakerOverride() { - return delegate.getLayoutManagerMakerOverride(); - } - - public ResourceResolver getResourceResolver() { - return delegate.getResourceResolver(); - } - - public URI getBaseURI() { - return delegate.getBaseURI(); - } - - public boolean validateStrictly() { - return delegate.validateStrictly(); - } - - public boolean validateUserConfigStrictly() { - return delegate.validateUserConfigStrictly(); - } - - public boolean isBreakIndentInheritanceOnReferenceAreaBoundary() { - return setBreakInheritance; - } - - public void setBreakIndentInheritanceOnReferenceAreaBoundary(boolean value) { - setBreakInheritance = value; - } - - public float getSourceResolution() { - return sourceResolution; - } - - public void setSourceResolution(float srcRes) { - sourceResolution = srcRes; - } - - public float getTargetResolution() { - return delegate.getTargetResolution(); - } - - public String getPageHeight() { - return delegate.getPageHeight(); - } - - public String getPageWidth() { - return delegate.getPageWidth(); - } - - public Set<String> getIgnoredNamespaces() { - return delegate.getIgnoredNamespaces(); - } - - public boolean isNamespaceIgnored(String namespace) { - return delegate.isNamespaceIgnored(namespace); - } - - public Configuration getUserConfig() { - return delegate.getUserConfig(); - } - - public boolean preferRenderer() { - return delegate.preferRenderer(); - } - - public FontManager getFontManager() { - return delegate.getFontManager(); - } - - public ImageManager getImageManager() { - return delegate.getImageManager(); - } - - public boolean isComplexScriptFeaturesEnabled() { - return delegate.isComplexScriptFeaturesEnabled(); - } - - public Map<String, String> getHyphenationPatternNames() { - return delegate.getHyphenationPatternNames(); - } - } } diff --git a/test/java/org/apache/fop/intermediate/IFParserTestCase.java b/test/java/org/apache/fop/intermediate/IFParserTestCase.java index 45aa8ab0f..9a08816c6 100644 --- a/test/java/org/apache/fop/intermediate/IFParserTestCase.java +++ b/test/java/org/apache/fop/intermediate/IFParserTestCase.java @@ -48,9 +48,6 @@ import org.apache.fop.render.intermediate.IFSerializer; @RunWith(Parameterized.class) 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 * @@ -59,19 +56,7 @@ public class IFParserTestCase extends AbstractIFTest { */ @Parameters public static Collection<File[]> getParameters() throws IOException { - Collection<File[]> testFiles = LayoutEngineTestUtils.getLayoutTestFiles(); - if (DEBUG) { - printFiles(testFiles); - } - return testFiles; - } - - private static void printFiles(Collection<File[]> files) { - int index = 0; - for (File[] file : files) { - assert file.length == 1; - System.out.println(String.format("%3d %s", index++, file[0])); - } + return LayoutEngineTestUtils.getLayoutTestFiles(); } /** diff --git a/test/java/org/apache/fop/layoutengine/LayoutEngineTestUtils.java b/test/java/org/apache/fop/layoutengine/LayoutEngineTestUtils.java index 935b86c3b..fb7f07023 100644 --- a/test/java/org/apache/fop/layoutengine/LayoutEngineTestUtils.java +++ b/test/java/org/apache/fop/layoutengine/LayoutEngineTestUtils.java @@ -51,6 +51,9 @@ import org.apache.commons.io.filefilter.TrueFileFilter; */ public final class LayoutEngineTestUtils { + /** Set this to true to get the correspondence between test number and test file. */ + private static final boolean DEBUG = false; + private LayoutEngineTestUtils() { } @@ -157,8 +160,12 @@ public final class LayoutEngineTestUtils { } Collection<File[]> parametersForJUnit4 = new ArrayList<File[]>(); + int index = 0; for (File f : files) { parametersForJUnit4.add(new File[] { f }); + if (DEBUG) { + System.out.println(String.format("%3d %s", index++, f)); + } } return parametersForJUnit4; diff --git a/test/java/org/apache/fop/pdf/TableHeaderScopeTestCase.java b/test/java/org/apache/fop/pdf/TableHeaderScopeTestCase.java new file mode 100644 index 000000000..89682628d --- /dev/null +++ b/test/java/org/apache/fop/pdf/TableHeaderScopeTestCase.java @@ -0,0 +1,131 @@ +/* + * 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.pdf; + +import org.junit.Test; +import org.mockito.ArgumentMatcher; +import org.mockito.verification.VerificationMode; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.argThat; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.apache.fop.pdf.StandardStructureAttributes.Table.Scope; +import org.apache.fop.pdf.StandardStructureTypes.Table; + +public class TableHeaderScopeTestCase { + + private static final String ATTRIBUTE_ENTRY = "A"; + + private VersionController controller; + + @Test + public void pdfDocumentDelegatesToVersionController() { + for (Scope scope : Scope.values()) { + testMakeStructureElementWithScope(scope); + } + } + + private void testMakeStructureElementWithScope(Scope scope) { + VersionController controller = mock(VersionController.class); + PDFDocument document = new PDFDocument("Test", controller); + document.makeStructTreeRoot(null); + document.makeStructureElement(Table.TH, null, scope); + verify(controller).addTableHeaderScopeAttribute(any(PDFStructElem.class), eq(scope)); + } + + @Test + public void versionControllerMayDelegateToScope() { + fixedController14doesNotAddAttribute(); + fixedController15addsAttribute(); + dynamicControllerAddsAttribute(); + } + + private void fixedController14doesNotAddAttribute() { + controller = VersionController.getFixedVersionController(Version.V1_4); + scopeMustNotBeAdded(); + } + + private void fixedController15addsAttribute() { + controller = VersionController.getFixedVersionController(Version.V1_5); + scopeMustBeAdded(); + } + + private void dynamicControllerAddsAttribute() { + PDFDocument document = new PDFDocument("Test"); + controller = VersionController.getDynamicVersionController(Version.V1_4, document); + scopeMustBeAdded(); + assertEquals(Version.V1_5, controller.getPDFVersion()); + } + + private void scopeMustBeAdded() { + scopeMustBeAdded(times(1)); + } + + private void scopeMustNotBeAdded() { + scopeMustBeAdded(never()); + } + + private void scopeMustBeAdded(VerificationMode nTimes) { + PDFStructElem structElem = mock(PDFStructElem.class); + controller.addTableHeaderScopeAttribute(structElem, Scope.COLUMN); + verify(structElem, nTimes).put(eq(ATTRIBUTE_ENTRY), any()); + } + + @Test + public void scopeAddsTheAttribute() { + for (Scope scope : Scope.values()) { + scopeAttributeMustBeAdded(scope); + } + } + + private void scopeAttributeMustBeAdded(Scope scope) { + PDFStructElem structElem = mock(PDFStructElem.class); + Scope.addScopeAttribute(structElem, scope); + verify(structElem).put(eq(ATTRIBUTE_ENTRY), scopeAttribute(scope)); + } + + private PDFDictionary scopeAttribute(Scope scope) { + return argThat(new isScopeAttribute(scope)); + } + + private static class isScopeAttribute extends ArgumentMatcher<PDFDictionary> { + + private final Scope expectedScope; + + public isScopeAttribute(Scope expectedScope) { + this.expectedScope = expectedScope; + } + + @Override + public boolean matches(Object argument) { + PDFDictionary attribute = (PDFDictionary) argument; + return "/Table".equals(attribute.get("O").toString()) + && expectedScope.getName().toString().equals(attribute.get("Scope").toString()); + } + + } + +} diff --git a/test/layoutengine/standard-testcases/list-item-body_break-before.xml b/test/layoutengine/standard-testcases/list-item-body_break-before.xml new file mode 100644 index 000000000..64e45ad8f --- /dev/null +++ b/test/layoutengine/standard-testcases/list-item-body_break-before.xml @@ -0,0 +1,96 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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$ --> +<testcase> + <info> + <p>This test checks basic breaks in list bodies.</p> + </info> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <fo:layout-master-set> + <fo:simple-page-master margin="5pt" page-width="11cm" page-height="3cm" + master-name="page"> + <fo:region-body /> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="page"> + <fo:flow flow-name="xsl-region-body"> + <fo:list-block provisional-distance-between-starts="20pt" + provisional-label-separation="5pt"> + <fo:list-item> + <fo:list-item-label end-indent="label-end()"> + <fo:block>(a)</fo:block> + </fo:list-item-label> + <fo:list-item-body start-indent="body-start()"> + <fo:block> + This content starts on page 1 and overflows to page 2. This content starts on page 1 and + overflows to page 2. This content starts on page 1 and overflows to page 2. This content + starts on page 1 and overflows to page 2. This content starts on page 1 and overflows to + page 2. This content starts on page 1 and overflows to page 2. This content starts on page 1 + and overflows to page 2. + <fo:block break-before="page" /> + This content is on page 3. + <fo:block break-before="page" /> + This content is on page 4. + </fo:block> + </fo:list-item-body> + </fo:list-item> + <fo:list-item> + <fo:list-item-label end-indent="label-end()"> + <fo:block>(b)</fo:block> + </fo:list-item-label> + <fo:list-item-body start-indent="body-start()"> + <fo:block> + <fo:block break-before="page" /> + This content is on page 5. + </fo:block> + </fo:list-item-body> + </fo:list-item> + <fo:list-item> + <fo:list-item-label end-indent="label-end()"> + <fo:block>(c)</fo:block> + </fo:list-item-label> + <fo:list-item-body start-indent="body-start()"> + <fo:block break-before="page"> + This content is on page 6. + </fo:block> + </fo:list-item-body> + </fo:list-item> + <fo:list-item break-before="page"> + <fo:list-item-label end-indent="label-end()"> + <fo:block>(d)</fo:block> + </fo:list-item-label> + <fo:list-item-body start-indent="body-start()"> + <fo:block> + This content is on page 7. + </fo:block> + </fo:list-item-body> + </fo:list-item> + </fo:list-block> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <eval expected="3" xpath="//lineArea[starts-with(., 'This content is on page 3.')]/ancestor::pageViewport/@nr" /> + <eval expected="4" xpath="//lineArea[starts-with(., 'This content is on page 4.')]/ancestor::pageViewport/@nr" /> + <eval expected="5" xpath="//lineArea[starts-with(., '(b)')]/ancestor::pageViewport/@nr" /> + <eval expected="6" xpath="//lineArea[starts-with(., '(c)')]/ancestor::pageViewport/@nr" /> + <eval expected="7" xpath="//lineArea[starts-with(., '(d)')]/ancestor::pageViewport/@nr" /> + </checks> +</testcase>
\ No newline at end of file diff --git a/test/layoutengine/standard-testcases/list-item-body_break-before_multicolumn.xml b/test/layoutengine/standard-testcases/list-item-body_break-before_multicolumn.xml new file mode 100644 index 000000000..a47daf107 --- /dev/null +++ b/test/layoutengine/standard-testcases/list-item-body_break-before_multicolumn.xml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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$ --> +<testcase> + <info> + <p>This test checks basic breaks in list bodies.</p> + </info> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <fo:layout-master-set> + <fo:simple-page-master margin="2cm" page-width="15.0cm" page-height="7.0cm" + master-name="page"> + <fo:region-body column-count="2" /> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="page"> + <fo:flow flow-name="xsl-region-body"> + <fo:list-block provisional-distance-between-starts="20pt" provisional-label-separation="5pt"> + <fo:list-item> + <fo:list-item-label end-indent="label-end()"> + <fo:block>(a)</fo:block> + </fo:list-item-label> + <fo:list-item-body start-indent="body-start()"> + <fo:block> + On first page, first column + <fo:block id="block-3" break-before="page" /> + On second page, first column, NOT first page, first column NEITHER first page, second column. + </fo:block> + </fo:list-item-body> + </fo:list-item> + </fo:list-block> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <eval expected="1" xpath="//lineArea[starts-with(., 'On first page')]/ancestor::pageViewport/@nr" /> + <eval expected="2" xpath="//lineArea[starts-with(., 'On second page')]/ancestor::pageViewport/@nr" /> + <eval expected="1" xpath="count(//block[@prod-id='block-3']/ancestor::flow)" /> + </checks> +</testcase>
\ No newline at end of file diff --git a/test/layoutengine/standard-testcases/page-sequence_last-page_space-before.xml b/test/layoutengine/standard-testcases/page-sequence_last-page_space-before.xml new file mode 100644 index 000000000..81f716105 --- /dev/null +++ b/test/layoutengine/standard-testcases/page-sequence_last-page_space-before.xml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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$ --> +<testcase> + <info> + <p>When layout is re-started for the last page, the space-before on the first element to appear + on that page must be discarded.</p> + </info> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <fo:layout-master-set> + <fo:simple-page-master master-name="page" + page-height="40pt" page-width="110pt" margin="5pt"> + <fo:region-body background-color="#F0F0F0"/> + </fo:simple-page-master> + <fo:page-sequence-master master-name="pages"> + <fo:repeatable-page-master-alternatives> + <fo:conditional-page-master-reference master-reference="page" page-position="last"/> + <fo:conditional-page-master-reference master-reference="page" page-position="any"/> + </fo:repeatable-page-master-alternatives> + </fo:page-sequence-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="pages" font-size="8pt" line-height="10pt"> + <fo:flow flow-name="xsl-region-body"> + <fo:block-container height="30pt"> + <fo:block>Filler 1</fo:block> + <fo:block>Filler 2</fo:block> + <fo:block>Filler 3</fo:block> + </fo:block-container> + <fo:block-container height="20pt" keep-with-next.within-page="always"> + <fo:block>Before line 1</fo:block> + </fo:block-container> + <fo:block>Before the page break</fo:block> + <fo:block space-before="10pt">After the page break</fo:block> + <fo:block>After line 1</fo:block> + <fo:block>After line 2</fo:block> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <eval expected="3" xpath="count(//pageViewport)"/> + </checks> +</testcase> diff --git a/test/layoutengine/standard-testcases/table-cell_break-before_multicolumn.xml b/test/layoutengine/standard-testcases/table-cell_break-before_multicolumn.xml new file mode 100644 index 000000000..cb8398af0 --- /dev/null +++ b/test/layoutengine/standard-testcases/table-cell_break-before_multicolumn.xml @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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$ --> +<testcase> + <info> + <p>This test checks basic breaks in table cells.</p> + </info> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <fo:layout-master-set> + <fo:simple-page-master margin="2cm" page-width="21.0cm" page-height="29.7cm" + master-name="A4-portrait"> + <fo:region-body column-count="2" /> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="A4-portrait"> + <fo:flow flow-name="xsl-region-body"> + <fo:table> + <fo:table-body> + <fo:table-row> + <fo:table-cell> + <fo:block>Page 1, Column 1, Cell 1</fo:block> + </fo:table-cell> + <fo:table-cell> + <fo:block>Page 1, Column 1, Cell 2</fo:block> + </fo:table-cell> + <fo:table-cell> + <fo:block>Page 1, Column 1, Cell 3</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell> + <fo:block id="block-4">Page 2, Column 1, Cell 1</fo:block> + </fo:table-cell> + <fo:table-cell> + <fo:block break-before="page">Page 2, Column 1, Cell 2</fo:block> + </fo:table-cell> + <fo:table-cell> + <fo:block>Page 2, Column 1, Cell 3</fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-body> + </fo:table> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <eval expected="1" xpath="//lineArea[starts-with(., 'Page 1')]/ancestor::pageViewport/@nr" /> + <eval expected="2" xpath="//lineArea[starts-with(., 'Page 2')]/ancestor::pageViewport/@nr" /> + <eval expected="1" xpath="count(//block[@prod-id='block-4']/ancestor::flow)" /> + </checks> +</testcase>
\ No newline at end of file diff --git a/test/pdf/1.5/test.pdf b/test/pdf/1.5/test.pdf Binary files differindex 6175a270f..d97648e1e 100644 --- a/test/pdf/1.5/test.pdf +++ b/test/pdf/1.5/test.pdf diff --git a/test/pdf/accessibility/fop.xconf b/test/pdf/accessibility/fop.xconf index adfccd2cc..24346a16a 100644 --- a/test/pdf/accessibility/fop.xconf +++ b/test/pdf/accessibility/fop.xconf @@ -6,6 +6,7 @@ <font-base>../../resources/fonts/ttf/</font-base> <renderers> <renderer mime="application/pdf"> + <version>1.4</version> <filterList> <value>null</value> </filterList> diff --git a/test/pdf/accessibility/pdf/complete.pdf b/test/pdf/accessibility/pdf/complete.pdf Binary files differindex 3aada8c00..a9bb3df77 100644 --- a/test/pdf/accessibility/pdf/complete.pdf +++ b/test/pdf/accessibility/pdf/complete.pdf diff --git a/test/pdf/accessibility/pdf/table_row-col-span.pdf b/test/pdf/accessibility/pdf/table_row-col-span.pdf Binary files differnew file mode 100644 index 000000000..65921fe5a --- /dev/null +++ b/test/pdf/accessibility/pdf/table_row-col-span.pdf diff --git a/test/pdf/accessibility/table_row-col-span.fo b/test/pdf/accessibility/table_row-col-span.fo new file mode 100644 index 000000000..1d28d4406 --- /dev/null +++ b/test/pdf/accessibility/table_row-col-span.fo @@ -0,0 +1,147 @@ +<?xml version="1.0" encoding="utf-8"?> +<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <fo:layout-master-set> + <fo:simple-page-master master-name="page" page-height="320pt" page-width="420pt" margin="10pt"> + <fo:region-body display-align="center"/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence master-reference="page"> + <fo:flow flow-name="xsl-region-body"> + <fo:table table-layout="fixed" width="100%" border-collapse="separate" + border-separation="4pt"> + <fo:table-body> + <fo:table-row> + <fo:table-cell number-columns-spanned="2" background-color="orange" padding-left="1pt"> + <fo:block>Cells 1.1 and 1.2.</fo:block> + </fo:table-cell> + <fo:table-cell> + <fo:block>Cell 1.3.</fo:block> + </fo:table-cell> + <fo:table-cell> + <fo:block>Cell 1.4.</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell> + <fo:block>Cell 2.1.</fo:block> + </fo:table-cell> + <fo:table-cell number-columns-spanned="2" background-color="orange" padding-left="1pt"> + <fo:block>Cells 2.2 and 2.3.</fo:block> + </fo:table-cell> + <fo:table-cell> + <fo:block>Cell 2.4.</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell> + <fo:block>Cell 3.1.</fo:block> + </fo:table-cell> + <fo:table-cell> + <fo:block>Cell 3.2.</fo:block> + </fo:table-cell> + <fo:table-cell number-columns-spanned="2" background-color="orange" padding-left="1pt"> + <fo:block>Cells 3.3 and 3.4.</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell number-columns-spanned="3" background-color="orange" padding-left="1pt"> + <fo:block>Cells 4.1, 4.2 and 4.3.</fo:block> + </fo:table-cell> + <fo:table-cell> + <fo:block>Cell 4.4.</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell number-columns-spanned="4" background-color="orange" padding-left="1pt"> + <fo:block>Cells 5.1, 5.2, 5.3 and 5.4.</fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-body> + </fo:table> + + <fo:table table-layout="fixed" width="100%" space-before="40pt" border-collapse="separate" + border-separation="4pt"> + <fo:table-body> + <fo:table-row> + <fo:table-cell number-rows-spanned="2" background-color="orange" padding-left="1pt"> + <fo:block>Cells 1.1</fo:block> + <fo:block>and 2.1.</fo:block> + </fo:table-cell> + <fo:table-cell> + <fo:block>Cell 1.2.</fo:block> + </fo:table-cell> + <fo:table-cell> + <fo:block>Cell 1.3.</fo:block> + </fo:table-cell> + <fo:table-cell number-rows-spanned="4" background-color="orange" padding-left="1pt"> + <fo:block>Cells 1.4,</fo:block> + <fo:block>2.4,</fo:block> + <fo:block>3.4</fo:block> + <fo:block>and 4.4.</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell number-rows-spanned="2" background-color="orange" padding-left="1pt"> + <fo:block>Cells 2.2</fo:block> + <fo:block>and 3.2.</fo:block> + </fo:table-cell> + <fo:table-cell number-rows-spanned="3" background-color="orange" padding-left="1pt"> + <fo:block>Cells 2.3,</fo:block> + <fo:block>3.3</fo:block> + <fo:block>and 4.3.</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell> + <fo:block>Cell 3.1.</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell> + <fo:block>Cell 4.1.</fo:block> + </fo:table-cell> + <fo:table-cell> + <fo:block>Cell 4.2.</fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-body> + </fo:table> + + <fo:table table-layout="fixed" width="100%" space-before="40pt" border-collapse="separate" + border-separation="4pt"> + <fo:table-body> + <fo:table-row> + <fo:table-cell number-rows-spanned="2" number-columns-spanned="3" + background-color="orange" padding-left="1pt"> + <fo:block>Cells 1.1, 1.2, 1.3</fo:block> + <fo:block>and 2.1, 2.2, 2.3.</fo:block> + </fo:table-cell> + <fo:table-cell> + <fo:block>Cell 1.4.</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell> + <fo:block>Cell 2.4.</fo:block> + </fo:table-cell> + </fo:table-row> + <fo:table-row> + <fo:table-cell> + <fo:block>Cell 3.1.</fo:block> + </fo:table-cell> + <fo:table-cell> + <fo:block>Cell 3.2.</fo:block> + </fo:table-cell> + <fo:table-cell> + <fo:block>Cell 3.3.</fo:block> + </fo:table-cell> + <fo:table-cell> + <fo:block>Cell 3.4.</fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-body> + </fo:table> + + </fo:flow> + </fo:page-sequence> +</fo:root> |