[FOray-commit] SF.net SVN: foray: [10338] trunk/foray
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2008-02-23 16:03:52
|
Revision: 10338
http://foray.svn.sourceforge.net/foray/?rev=10338&view=rev
Author: victormote
Date: 2008-02-23 08:03:45 -0800 (Sat, 23 Feb 2008)
Log Message:
-----------
Stub in a test for vertical-align and related.
Modified Paths:
--------------
trunk/foray/foray-app/src/javatest/org/foray/app/area/AbstractAreaTreeTest.java
Added Paths:
-----------
trunk/foray/foray-app/src/javatest/org/foray/app/area/TestVertical.java
trunk/foray/resource/test/fo/vertical-001.fo
Modified: trunk/foray/foray-app/src/javatest/org/foray/app/area/AbstractAreaTreeTest.java
===================================================================
--- trunk/foray/foray-app/src/javatest/org/foray/app/area/AbstractAreaTreeTest.java 2008-02-22 17:49:14 UTC (rev 10337)
+++ trunk/foray/foray-app/src/javatest/org/foray/app/area/AbstractAreaTreeTest.java 2008-02-23 16:03:45 UTC (rev 10338)
@@ -44,7 +44,7 @@
import junit.framework.TestCase;
/**
- * Abstract superclass for test classes testing FO Tree content.
+ * Abstract superclass for test classes testing Area Tree content.
*/
public abstract class AbstractAreaTreeTest extends TestCase {
Added: trunk/foray/foray-app/src/javatest/org/foray/app/area/TestVertical.java
===================================================================
--- trunk/foray/foray-app/src/javatest/org/foray/app/area/TestVertical.java (rev 0)
+++ trunk/foray/foray-app/src/javatest/org/foray/app/area/TestVertical.java 2008-02-23 16:03:45 UTC (rev 10338)
@@ -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.area;
+
+import org.foray.area.AreaNode;
+import org.foray.area.AreaTree;
+import org.foray.area.InlineArea;
+import org.foray.area.LineArea;
+import org.foray.area.NormalBlockArea;
+import org.foray.area.NormalFlowRA;
+import org.foray.core.FOrayException;
+
+/**
+ * Tests of various vertical positioning concepts at the Area Tree level.
+ */
+public class TestVertical extends AbstractAreaTreeTest {
+
+ /**
+ * Test of fo/vertical-001.fo.
+ * @throws FOrayException For errors creating the FO Tree or Area Tree.
+ */
+ public void testVertical001() throws FOrayException {
+ final AreaTreeCreator creator = AreaTreeCreator.getInstance();
+ final AreaTree areaTree = creator.buildAreaTree("fo/vertical-001.fo");
+ final NormalFlowRA firstNormalFlowArea = this.getFirstNormalFlowArea(
+ areaTree);
+
+ /* The block area. */
+ AreaNode node = firstNormalFlowArea.getChildAt(0);
+ assertTrue(node instanceof NormalBlockArea);
+ final NormalBlockArea blockArea = (NormalBlockArea) node;
+
+ /* The first child of the block area is a line-area. */
+ node = blockArea.getChildAt(0);
+ assertTrue(node instanceof LineArea);
+ final LineArea lineArea = (LineArea) node;
+ final int lineY = lineArea.alignmentPointY();
+
+ /* The second child of the line area is an inline-area. */
+ node = lineArea.getChildAt(1);
+ assertTrue(node instanceof InlineArea);
+ final InlineArea inlineArea = (InlineArea) node;
+ final int inlineY = inlineArea.baselineY();
+
+ final int expectedInlineY = lineY - 20;
+ assertEquals(expectedInlineY, inlineY);
+ }
+
+}
Property changes on: trunk/foray/foray-app/src/javatest/org/foray/app/area/TestVertical.java
___________________________________________________________________
Name: svn:keywords
+ "Author Id Rev Date URL"
Name: svn:eol-style
+ native
Added: trunk/foray/resource/test/fo/vertical-001.fo
===================================================================
--- trunk/foray/resource/test/fo/vertical-001.fo (rev 0)
+++ trunk/foray/resource/test/fo/vertical-001.fo 2008-02-23 16:03:45 UTC (rev 10338)
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+This fo file contains one empty block nested inside another block and tests that
+the three resulting block areas exist and are positioned correctly.
+-->
+
+<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+
+<fo:layout-master-set>
+ <!-- layout for the first page -->
+ <fo:simple-page-master master-name="simple"
+ margin-top="1in"
+ margin-bottom="1in"
+ margin-left="1in"
+ margin-right="1in">
+ <fo:region-body/>
+ </fo:simple-page-master>
+</fo:layout-master-set>
+
+<fo:page-sequence master-reference="simple">
+<fo:flow flow-name="xsl-region-body">
+
+
+<fo:block font-family="Courier" font-size="12pt">At the end of this sentence is a footnote
+citation.<fo:inline font-size="60%" vertical-align="super">7</fo:inline></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.
|