From 8eefdf7d68cc640ca4c3d4ac331e5af1a9049ee0 Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Fri, 17 Apr 2009 12:10:07 +0000 Subject: 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 --- test/java/org/apache/fop/util/XMLUtilTestCase.java | 45 ++++++++++++++++++++++ .../standard-testcases/page-sequence_language.xml | 6 +++ 2 files changed, 51 insertions(+) create mode 100644 test/java/org/apache/fop/util/XMLUtilTestCase.java (limited to 'test') 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 @@ + + + + + + -- cgit v1.2.3