Revision: 8452
http://svn.sourceforge.net/foray/?rev=8452&view=rev
Author: victormote
Date: 2006-11-09 17:08:30 -0800 (Thu, 09 Nov 2006)
Log Message:
-----------
Add a test class for the LineHeight property.
Modified Paths:
--------------
trunk/foray/foray-fotree/src/javatest/org/foray/fotree/TestFOrayFOTree.java
Added Paths:
-----------
trunk/foray/foray-fotree/src/javatest/org/foray/fotree/TestProperty.java
trunk/foray/foray-fotree/src/javatest/org/foray/fotree/fo/
trunk/foray/foray-fotree/src/javatest/org/foray/fotree/fo/prop/
trunk/foray/foray-fotree/src/javatest/org/foray/fotree/fo/prop/TestLineHeight.java
Modified: trunk/foray/foray-fotree/src/javatest/org/foray/fotree/TestFOrayFOTree.java
===================================================================
--- trunk/foray/foray-fotree/src/javatest/org/foray/fotree/TestFOrayFOTree.java 2006-10-28 23:43:14 UTC (rev 8451)
+++ trunk/foray/foray-fotree/src/javatest/org/foray/fotree/TestFOrayFOTree.java 2006-11-10 01:08:30 UTC (rev 8452)
@@ -28,6 +28,7 @@
package org.foray.fotree;
+import org.foray.fotree.fo.prop.TestLineHeight;
import org.foray.fotree.value.TestDtLength;
import junit.framework.Test;
@@ -45,7 +46,13 @@
*/
public static Test suite() {
final TestSuite testSuite = new TestSuite();
+
+ /* Add tests of property value classes. */
testSuite.addTestSuite(TestDtLength.class);
+
+ /* Add tests of FO properties. */
+ testSuite.addTestSuite(TestLineHeight.class);
+
return testSuite;
}
Added: trunk/foray/foray-fotree/src/javatest/org/foray/fotree/TestProperty.java
===================================================================
--- trunk/foray/foray-fotree/src/javatest/org/foray/fotree/TestProperty.java (rev 0)
+++ trunk/foray/foray-fotree/src/javatest/org/foray/fotree/TestProperty.java 2006-11-10 01:08:30 UTC (rev 8452)
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2006 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.fotree;
+
+import org.foray.fotree.fo.obj.Root;
+
+import org.axsl.foR.FOContext;
+import org.axsl.foR.fo.RetrieveMarker;
+
+import junit.framework.TestCase;
+
+/**
+ * Superclass for all tests of Property classes.
+ */
+public class TestProperty extends TestCase {
+
+ /** Constant providing a standard instance of PropertyList to be used
+ * during property construction. */
+ protected static final PropertyList STD_PROPERTY_LIST = new PropertyList();
+
+ /** Constant providing a standard instance of Root to be used during
+ * property construction. */
+ protected static final Root STD_ROOT = new Root(null, STD_PROPERTY_LIST,
+ "JUnit", -1, -1);
+
+ /** Constant providing a standard, but completely bogus context to be
+ * used during retrieval of property values. */
+ protected static final FOContext STD_FO_CONTEXT = new FOContext() {
+ public RetrieveMarker getRetrieveMarker() {
+ return null;
+ }
+ };
+
+ /** The instance of Property List to be used for this test. */
+ private PropertyList propertyList = STD_PROPERTY_LIST;
+
+ protected PropertyList propertyList() {
+ return this.propertyList;
+ }
+
+}
Property changes on: trunk/foray/foray-fotree/src/javatest/org/foray/fotree/TestProperty.java
___________________________________________________________________
Name: svn:keywords
+ "Author Id Rev Date URL"
Name: svn:eol-style
+ native
Added: trunk/foray/foray-fotree/src/javatest/org/foray/fotree/fo/prop/TestLineHeight.java
===================================================================
--- trunk/foray/foray-fotree/src/javatest/org/foray/fotree/fo/prop/TestLineHeight.java (rev 0)
+++ trunk/foray/foray-fotree/src/javatest/org/foray/fotree/fo/prop/TestLineHeight.java 2006-11-10 01:08:30 UTC (rev 8452)
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2006 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.fotree.fo.prop;
+
+import org.foray.fotree.FObj;
+import org.foray.fotree.PropertyException;
+import org.foray.fotree.TestProperty;
+
+import org.axsl.common.Constants;
+
+/**
+ * JUnit test class for the class {@link LineHeight}.
+ */
+public class TestLineHeight extends TestProperty {
+
+ /**
+ * Unit test for a "length" value.
+ */
+ public void testLength() throws PropertyException {
+ final LineHeight lh = new LineHeight(propertyList(),
+ Constants.FOPROP_LINE_HEIGHT, "", "3.7cm");
+ propertyList().addProperty(lh);
+ final FObj fobj = STD_PROPERTY_LIST.getFObj();
+ final int halfLeadingMax = fobj.traitHalfLeadingMax(STD_FO_CONTEXT);
+ /* D = Distance between baselines = 3.7cm = 104,882 millipoints.
+ * L = Leading = D - the default font size of 12,000 = 92,882
+ * millipoints.
+ * HL = L / 2 = 46,441 millipoints. */
+ assertEquals(46441, halfLeadingMax);
+ final int halfLeadingOpt = fobj.traitHalfLeadingOpt(STD_FO_CONTEXT);
+ assertEquals(46441, halfLeadingOpt);
+ final int halfLeadingMin = fobj.traitHalfLeadingOpt(STD_FO_CONTEXT);
+ assertEquals(46441, halfLeadingMin);
+ }
+
+}
Property changes on: trunk/foray/foray-fotree/src/javatest/org/foray/fotree/fo/prop/TestLineHeight.java
___________________________________________________________________
Name: svn:keywords
+ "Author Id Rev Date URL"
Name: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|