diff options
author | Jeremias Maerki <jeremias@apache.org> | 2009-04-17 12:10:07 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2009-04-17 12:10:07 +0000 |
commit | 8eefdf7d68cc640ca4c3d4ac331e5af1a9049ee0 (patch) | |
tree | d7ff2463e2e2ce6a322e9df1796a8b205f2c5440 /test | |
parent | eeb0cc4fb8f3816e7507ce22de0fb4b9dd433f1c (diff) | |
download | xmlgraphics-fop-8eefdf7d68cc640ca4c3d4ac331e5af1a9049ee0.tar.gz xmlgraphics-fop-8eefdf7d68cc640ca4c3d4ac331e5af1a9049ee0.zip |
Added support for adding natural language information on page-sequence and document level to a tagged PDF.
The document-level language is assumed to be the language of the first page-sequence.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_Accessibility@765965 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test')
-rw-r--r-- | test/java/org/apache/fop/util/XMLUtilTestCase.java | 45 | ||||
-rw-r--r-- | test/layoutengine/standard-testcases/page-sequence_language.xml | 6 |
2 files changed, 51 insertions, 0 deletions
diff --git a/test/java/org/apache/fop/util/XMLUtilTestCase.java b/test/java/org/apache/fop/util/XMLUtilTestCase.java new file mode 100644 index 000000000..3e86b978e --- /dev/null +++ b/test/java/org/apache/fop/util/XMLUtilTestCase.java @@ -0,0 +1,45 @@ +/* + * 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.util; + +import java.util.Locale; + +import junit.framework.TestCase; + +/** + * Tests {@link XMLUtil}. + */ +public class XMLUtilTestCase extends TestCase { + + public void testLocaleToRFC3066() throws Exception { + assertNull(XMLUtil.toRFC3066(null)); + assertEquals("en", XMLUtil.toRFC3066(new Locale("en"))); + assertEquals("en-US", XMLUtil.toRFC3066(new Locale("en", "US"))); + assertEquals("en-US", XMLUtil.toRFC3066(new Locale("EN", "us"))); + } + + public void testRFC3066ToLocale() throws Exception { + assertNull(XMLUtil.convertRFC3066ToLocale(null)); + assertNull(XMLUtil.convertRFC3066ToLocale("")); + assertEquals(new Locale("en"), XMLUtil.convertRFC3066ToLocale("en")); + assertEquals(new Locale("en", "US"), XMLUtil.convertRFC3066ToLocale("en-US")); + assertEquals(new Locale("en", "US"), XMLUtil.convertRFC3066ToLocale("EN-us")); + } +} diff --git a/test/layoutengine/standard-testcases/page-sequence_language.xml b/test/layoutengine/standard-testcases/page-sequence_language.xml index 93238e282..f2fa610bc 100644 --- a/test/layoutengine/standard-testcases/page-sequence_language.xml +++ b/test/layoutengine/standard-testcases/page-sequence_language.xml @@ -65,4 +65,10 @@ <eval expected="de" xpath="/areaTree/pageSequence[4]/@language"/> <true xpath="not(boolean(/areaTree/pageSequence[4]/@country))"/> </checks> + <if-checks xmlns:if="http://xmlgraphics.apache.org/fop/intermediate"> + <eval expected="en" xpath="//if:page-sequence[1]/@xml:lang"/> + <eval expected="en-US" xpath="//if:page-sequence[2]/@xml:lang"/> + <eval expected="de-CH" xpath="//if:page-sequence[3]/@xml:lang"/> + <eval expected="de" xpath="//if:page-sequence[4]/@xml:lang"/> + </if-checks> </testcase> |