[FOray-commit] SF.net SVN: foray: [8436] trunk/foray/foray-ps
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2006-10-27 17:13:08
|
Revision: 8436
http://svn.sourceforge.net/foray/?rev=8436&view=rev
Author: victormote
Date: 2006-10-27 10:12:49 -0700 (Fri, 27 Oct 2006)
Log Message:
-----------
1. Make method more visible and static to facilitate testing.
2. Add a test of the ASCII85Filter.
Modified Paths:
--------------
trunk/foray/foray-ps/.classpath
trunk/foray/foray-ps/src/java/org/foray/ps/filter/ASCII85Filter.java
Added Paths:
-----------
trunk/foray/foray-ps/src/javatest/
trunk/foray/foray-ps/src/javatest/org/
trunk/foray/foray-ps/src/javatest/org/foray/
trunk/foray/foray-ps/src/javatest/org/foray/ps/
trunk/foray/foray-ps/src/javatest/org/foray/ps/TestFOrayPS.java
trunk/foray/foray-ps/src/javatest/org/foray/ps/filter/
trunk/foray/foray-ps/src/javatest/org/foray/ps/filter/TestASCII85Filter.java
Modified: trunk/foray/foray-ps/.classpath
===================================================================
--- trunk/foray/foray-ps/.classpath 2006-10-27 16:10:37 UTC (rev 8435)
+++ trunk/foray/foray-ps/.classpath 2006-10-27 17:12:49 UTC (rev 8436)
@@ -2,10 +2,12 @@
<classpath>
<classpathentry excluding=".#*" kind="src" path="src/java"/>
<classpathentry kind="src" path="scripts"/>
+ <classpathentry kind="src" path="src/javatest"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="src" path="/FOrayCommon"/>
<classpathentry kind="src" path="/axslPS-R"/>
<classpathentry kind="src" path="/axslCommon"/>
<classpathentry kind="var" path="FORAY_LIB_ROOT/commons-logging.jar"/>
+ <classpathentry kind="lib" path="/FOrayLibsBuild/junit/junit.jar"/>
<classpathentry kind="output" path="build/eclipse"/>
</classpath>
Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/ASCII85Filter.java
===================================================================
--- trunk/foray/foray-ps/src/java/org/foray/ps/filter/ASCII85Filter.java 2006-10-27 16:10:37 UTC (rev 8435)
+++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/ASCII85Filter.java 2006-10-27 17:12:49 UTC (rev 8436)
@@ -159,7 +159,7 @@
* @param bytes The bytes to be converted.
* @return The long containing the 4 byte values.
*/
- private long encodeAsLong(final byte[] bytes) {
+ protected static long encodeAsLong(final byte[] bytes) {
if (bytes == null
|| bytes.length != UNENCODED_BLOCK_SIZE) {
return -1;
@@ -187,7 +187,8 @@
* values of 0)
* @throws PSFilterException If an illegal character is found in the input.
*/
- private byte[] convertWord(final long word) throws PSFilterException {
+ protected static byte[] convertWord(final long word)
+ throws PSFilterException {
long wordMasked = word & 0xffffffff;
if (wordMasked < 0) {
wordMasked = -wordMasked;
Added: trunk/foray/foray-ps/src/javatest/org/foray/ps/TestFOrayPS.java
===================================================================
--- trunk/foray/foray-ps/src/javatest/org/foray/ps/TestFOrayPS.java (rev 0)
+++ trunk/foray/foray-ps/src/javatest/org/foray/ps/TestFOrayPS.java 2006-10-27 17:12:49 UTC (rev 8436)
@@ -0,0 +1,52 @@
+/*
+ * 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.ps;
+
+import org.foray.ps.filter.TestASCII85Filter;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Handles testing for the FOrayPS module.
+ */
+public class TestFOrayPS extends TestCase {
+
+ /**
+ * Builds a test suite for all classes in this module.
+ * @return The built test suite.
+ */
+ public static Test suite() {
+ final TestSuite testSuite = new TestSuite();
+ testSuite.addTestSuite(TestASCII85Filter.class);
+ return testSuite;
+ }
+
+}
Property changes on: trunk/foray/foray-ps/src/javatest/org/foray/ps/TestFOrayPS.java
___________________________________________________________________
Name: svn:keywords
+ "Author Id Rev Date URL"
Name: svn:eol-style
+ native
Added: trunk/foray/foray-ps/src/javatest/org/foray/ps/filter/TestASCII85Filter.java
===================================================================
--- trunk/foray/foray-ps/src/javatest/org/foray/ps/filter/TestASCII85Filter.java (rev 0)
+++ trunk/foray/foray-ps/src/javatest/org/foray/ps/filter/TestASCII85Filter.java 2006-10-27 17:12:49 UTC (rev 8436)
@@ -0,0 +1,53 @@
+/*
+ * 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.ps.filter;
+
+import java.util.Arrays;
+
+import junit.framework.TestCase;
+
+/**
+ * JUnit test class for the class {@link ASCII85Filter}.
+ */
+public class TestASCII85Filter extends TestCase {
+
+/**
+ * Unit test for encoding 4 bytes.
+ * @throws PSFilterException for input errors.
+ */
+public void testEncode() throws PSFilterException {
+ final byte[] testInput = new byte[] {120, -100, -84, 120};
+ final byte[] expectedOutput = new byte[] {71, 97, 116, 106, 91};
+ final long value = ASCII85Filter.encodeAsLong(testInput);
+ assertEquals(2023533688, value);
+ final byte[] testOutput = ASCII85Filter.convertWord(value);
+ assertTrue(Arrays.equals(expectedOutput, testOutput));
+}
+
+}
Property changes on: trunk/foray/foray-ps/src/javatest/org/foray/ps/filter/TestASCII85Filter.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.
|