[FOray-commit] SF.net SVN: foray: [9213] trunk/foray
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2007-04-18 21:45:18
|
Revision: 9213
http://svn.sourceforge.net/foray/?rev=9213&view=rev
Author: victormote
Date: 2007-04-18 14:45:19 -0700 (Wed, 18 Apr 2007)
Log Message:
-----------
Move, rename, and use test file for font-size.
Modified Paths:
--------------
trunk/foray/foray-app/src/javatest/org/foray/app/TestFOrayApp.java
trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java
Added Paths:
-----------
trunk/foray/foray-app/src/javatest/org/foray/app/TestFont.java
trunk/foray/resource/test/fo/font-size-001.fo
Removed Paths:
-------------
trunk/foray/resource/test/xml/bugtests/font-size.fo
Modified: trunk/foray/foray-app/src/javatest/org/foray/app/TestFOrayApp.java
===================================================================
--- trunk/foray/foray-app/src/javatest/org/foray/app/TestFOrayApp.java 2007-04-18 21:20:58 UTC (rev 9212)
+++ trunk/foray/foray-app/src/javatest/org/foray/app/TestFOrayApp.java 2007-04-18 21:45:19 UTC (rev 9213)
@@ -45,6 +45,7 @@
final TestSuite testSuite = new TestSuite();
testSuite.addTestSuite(TestInvalidXml.class);
+ testSuite.addTestSuite(TestFont.class);
return testSuite;
}
Added: trunk/foray/foray-app/src/javatest/org/foray/app/TestFont.java
===================================================================
--- trunk/foray/foray-app/src/javatest/org/foray/app/TestFont.java (rev 0)
+++ trunk/foray/foray-app/src/javatest/org/foray/app/TestFont.java 2007-04-18 21:45:19 UTC (rev 9213)
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2007 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed 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.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.app;
+
+import org.foray.core.FOrayException;
+import org.foray.fotree.FONode;
+import org.foray.fotree.FOTreeBuilder;
+import org.foray.fotree.fo.obj.Block;
+import org.foray.fotree.fo.obj.Flow;
+import org.foray.fotree.fo.obj.PageSequence;
+import org.foray.fotree.fo.obj.Root;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests of various font properties at the FO Tree level.
+ */
+public class TestFont extends TestCase {
+
+ /**
+ * Test of fo/font-size-001.fo.
+ * @throws FOrayException For errors creating the FO Tree.
+ */
+ public void testFontSize001() throws FOrayException {
+ final FoDocumentReader reader = FoDocumentReader.getInstance();
+ final FOTreeBuilder foTree = reader.buildFoTree("fo/font-size-001.fo");
+ final Root root = foTree.getRootFObj();
+ FONode node = root.getChildAt(1);
+ assertTrue(node instanceof PageSequence);
+ final PageSequence sequence = (PageSequence) node;
+ node = sequence.getChildAt(0);
+ assertTrue(node instanceof Flow);
+ final Flow flow = (Flow) node;
+
+ node = flow.getChildAt(0);
+ assertTrue(node instanceof Block);
+ Block block = (Block) node;
+ int fontSize = block.traitFontSize(null);
+ /* The default font size is 12 points. */
+ assertEquals(12000, fontSize);
+
+ node = flow.getChildAt(1);
+ assertTrue(node instanceof Block);
+ block = (Block) node;
+ fontSize = block.traitFontSize(null);
+ assertEquals(8000, fontSize);
+ }
+
+}
Property changes on: trunk/foray/foray-app/src/javatest/org/foray/app/TestFont.java
___________________________________________________________________
Name: svn:keywords
+ "Author Id Rev Date URL"
Name: svn:eol-style
+ native
Modified: trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java
===================================================================
--- trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java 2007-04-18 21:20:58 UTC (rev 9212)
+++ trunk/foray/foray-fotree/src/java/org/foray/fotree/FOTreeBuilder.java 2007-04-18 21:45:19 UTC (rev 9213)
@@ -432,7 +432,7 @@
/**
* {@inheritDoc}
*/
- public org.axsl.foR.fo.Root getRootFObj() {
+ public Root getRootFObj() {
return this.rootFObj;
}
Copied: trunk/foray/resource/test/fo/font-size-001.fo (from rev 9211, trunk/foray/resource/test/xml/bugtests/font-size.fo)
===================================================================
--- trunk/foray/resource/test/fo/font-size-001.fo (rev 0)
+++ trunk/foray/resource/test/fo/font-size-001.fo 2007-04-18 21:45:19 UTC (rev 9213)
@@ -0,0 +1,53 @@
+<?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="simplePM"
+ page-height="25cm"
+ page-width="20cm"
+ margin-top="1cm"
+ margin-bottom="1cm"
+ margin-left="1.5cm"
+ margin-right="1.5cm">
+ <fo:region-before extent="2.5cm"/>
+ <fo:region-body margin-top="3cm" margin-bottom="3cm"/>
+ <fo:region-after extent="2.5cm"/>
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+
+ <fo:page-sequence master-reference="simplePM">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:block>
+ This is a simple fo text in the default font size and default font.
+ </fo:block>
+
+ <fo:block font-family="Courier" font-size="8pt">
+ This is a simple fo text in 8pt font Courier.
+ </fo:block>
+ <fo:block font-family="Courier" font-size="10pt">
+ This is a simple fo text in 10pt font.
+ </fo:block>
+ <fo:block font-family="Courier" font-size="12pt">
+ This is a simple fo text in 12pt font.
+ </fo:block>
+ <fo:block font-family="Courier" font-size="14pt">
+ This is a simple fo text in 14pt font.
+ </fo:block>
+ <fo:block font-family="Courier" font-size="16pt">
+ This is a simple fo text in 16pt font.
+ </fo:block>
+ <fo:block font-family="Courier" font-size="18pt">
+ This is a simple fo text in 18pt font.
+ </fo:block>
+ <fo:block font-family="Courier" font-size="20pt">
+ This is a simple fo text in 20pt font.
+ </fo:block>
+ <fo:block font-family="Courier" font-size="24pt">
+ This is a simple fo text in 24pt font.
+ </fo:block>
+ <fo:block font-family="Courier" font-size="32pt">
+ This is a simple fo text in 32pt font.
+ </fo:block>
+
+ </fo:flow>
+ </fo:page-sequence>
+</fo:root>
Deleted: trunk/foray/resource/test/xml/bugtests/font-size.fo
===================================================================
--- trunk/foray/resource/test/xml/bugtests/font-size.fo 2007-04-18 21:20:58 UTC (rev 9212)
+++ trunk/foray/resource/test/xml/bugtests/font-size.fo 2007-04-18 21:45:19 UTC (rev 9213)
@@ -1,53 +0,0 @@
-<?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="simplePM"
- page-height="25cm"
- page-width="20cm"
- margin-top="1cm"
- margin-bottom="1cm"
- margin-left="1.5cm"
- margin-right="1.5cm">
- <fo:region-before extent="2.5cm"/>
- <fo:region-body margin-top="3cm" margin-bottom="3cm"/>
- <fo:region-after extent="2.5cm"/>
- </fo:simple-page-master>
- </fo:layout-master-set>
-
- <fo:page-sequence master-reference="simplePM">
- <fo:flow flow-name="xsl-region-body">
- <fo:block>
- This is a simple fo text in the default font size and default font.
- </fo:block>
-
- <fo:block font-family="Courier" font-size="8pt">
- This is a simple fo text in 8pt font Courier.
- </fo:block>
- <fo:block font-family="Courier" font-size="10pt">
- This is a simple fo text in 10pt font.
- </fo:block>
- <fo:block font-family="Courier" font-size="12pt">
- This is a simple fo text in 12pt font.
- </fo:block>
- <fo:block font-family="Courier" font-size="14pt">
- This is a simple fo text in 14pt font.
- </fo:block>
- <fo:block font-family="Courier" font-size="16pt">
- This is a simple fo text in 16pt font.
- </fo:block>
- <fo:block font-family="Courier" font-size="18pt">
- This is a simple fo text in 18pt font.
- </fo:block>
- <fo:block font-family="Courier" font-size="20pt">
- This is a simple fo text in 20pt font.
- </fo:block>
- <fo:block font-family="Courier" font-size="24pt">
- This is a simple fo text in 24pt font.
- </fo:block>
- <fo:block font-family="Courier" font-size="32pt">
- This is a simple fo text in 32pt font.
- </fo:block>
-
- </fo:flow>
- </fo:page-sequence>
-</fo:root>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|