aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2008-01-28 15:04:39 +0000
committerJeremias Maerki <jeremias@apache.org>2008-01-28 15:04:39 +0000
commit1ea8b13df56f773fc3d28a9a4b69ed1ed8b97cf4 (patch)
treeaa175e32ee1cee808287fee13ff980747cfcc262 /test
parent74b2adc7ebb1c898d17bc5778de412522512d4c8 (diff)
downloadxmlgraphics-fop-1ea8b13df56f773fc3d28a9a4b69ed1ed8b97cf4.tar.gz
xmlgraphics-fop-1ea8b13df56f773fc3d28a9a4b69ed1ed8b97cf4.zip
Added support for the natural language indentifier ("Lang" in the document catalog) for PDF documents based on the language/country values on fo:page-sequence. This required a few changes in the AreaTreeModel and the Renderer interface because it didn't support passing through the PageSequence object, only its title. Now, we can put other values on the PageSequence and transport them to the renderers.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@615906 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test')
-rw-r--r--test/java/org/apache/fop/render/pdf/PDFAMetadataTestCase.java2
-rw-r--r--test/layoutengine/hyphenation-testcases/block_hyphenation_kerning.xml2
-rw-r--r--test/layoutengine/standard-testcases/page-sequence_language.xml68
3 files changed, 71 insertions, 1 deletions
diff --git a/test/java/org/apache/fop/render/pdf/PDFAMetadataTestCase.java b/test/java/org/apache/fop/render/pdf/PDFAMetadataTestCase.java
index 2821dcb24..b645022bb 100644
--- a/test/java/org/apache/fop/render/pdf/PDFAMetadataTestCase.java
+++ b/test/java/org/apache/fop/render/pdf/PDFAMetadataTestCase.java
@@ -94,7 +94,7 @@ public class PDFAMetadataTestCase extends TestCase {
cal2.set(Calendar.MILLISECOND, 0);
info.setModDate(cal2.getTime());
- Metadata meta = PDFMetadata.createXMPFromUserAgent(doc);
+ Metadata meta = PDFMetadata.createXMPFromPDFDocument(doc);
DublinCoreAdapter dc = DublinCoreSchema.getAdapter(meta);
assertEquals("MyTitle", dc.getTitle());
diff --git a/test/layoutengine/hyphenation-testcases/block_hyphenation_kerning.xml b/test/layoutengine/hyphenation-testcases/block_hyphenation_kerning.xml
index f1f0cbd1e..084f1e685 100644
--- a/test/layoutengine/hyphenation-testcases/block_hyphenation_kerning.xml
+++ b/test/layoutengine/hyphenation-testcases/block_hyphenation_kerning.xml
@@ -45,6 +45,8 @@
</fo>
<checks>
<eval expected="1" xpath="count(//pageViewport)"/>
+ <eval expected="en" xpath="/areaTree/pageSequence/@language"/>
+ <true xpath="not(boolean(/areaTree/pageSequence/@country))"/>
<eval expected="17230" xpath="//flow/block[1]/lineArea[1]/text[1]/@twsadjust"/>
<eval expected="-1339" xpath="//flow/block[1]/lineArea[2]/text[1]/@twsadjust"/>
diff --git a/test/layoutengine/standard-testcases/page-sequence_language.xml b/test/layoutengine/standard-testcases/page-sequence_language.xml
new file mode 100644
index 000000000..93238e282
--- /dev/null
+++ b/test/layoutengine/standard-testcases/page-sequence_language.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 the language and country property on page-sequence.
+ </p>
+ </info>
+ <fo>
+ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" language="en">
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="normal"
+ page-width="5in" page-height="5in">
+ <fo:region-body/>
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+ <fo:page-sequence master-reference="normal">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:block>language checking only</fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+ <fo:page-sequence master-reference="normal" language="en" country="US">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:block>language checking only</fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+ <fo:page-sequence master-reference="normal" language="de" country="CH">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:block>language checking only</fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+ <fo:page-sequence master-reference="normal" language="de" country="none">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:block>language checking only</fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+ </fo:root>
+ </fo>
+ <checks>
+ <eval expected="en" xpath="/areaTree/pageSequence[1]/@language"/>
+ <true xpath="not(boolean(/areaTree/pageSequence[1]/@country))"/>
+
+ <eval expected="en" xpath="/areaTree/pageSequence[2]/@language"/>
+ <eval expected="US" xpath="/areaTree/pageSequence[2]/@country"/>
+
+ <eval expected="de" xpath="/areaTree/pageSequence[3]/@language"/>
+ <eval expected="CH" xpath="/areaTree/pageSequence[3]/@country"/>
+
+ <eval expected="de" xpath="/areaTree/pageSequence[4]/@language"/>
+ <true xpath="not(boolean(/areaTree/pageSequence[4]/@country))"/>
+ </checks>
+</testcase>