xmlgraphics-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerem...@apache.org
Subject svn commit: r512838 [3/3] - in /xmlgraphics/commons/trunk: examples/java/ps/ src/documentation/content/xdocs/ src/java/org/apache/xmlgraphics/java2d/ps/ src/java/org/apache/xmlgraphics/ps/ src/java/org/apache/xmlgraphics/ps/dsc/ src/java/org/apache/xml...
Date Wed, 28 Feb 2007 16:42:31 GMT
Added: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/ps/dsc/events/package.html
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/ps/dsc/events/package.html?view=auto&rev=512838
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/ps/dsc/events/package.html (added)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/ps/dsc/events/package.html Wed
Feb 28 08:42:28 2007
@@ -0,0 +1,23 @@
+<!--
+  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$ -->
+<HTML>
+<TITLE>org.apache.xmlgraphics.ps.dsc.events Package</TITLE>
+<BODY>
+<P>Event classes used by the DSC parser.</P>
+</BODY>
+</HTML>
\ No newline at end of file

Propchange: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/ps/dsc/events/package.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/ps/dsc/package.html
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/ps/dsc/package.html?view=auto&rev=512838
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/ps/dsc/package.html (added)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/ps/dsc/package.html Wed Feb
28 08:42:28 2007
@@ -0,0 +1,23 @@
+<!--
+  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$ -->
+<HTML>
+<TITLE>org.apache.xmlgraphics.ps.dsc Package</TITLE>
+<BODY>
+<P>Tools for DSC-compliant PostScript files (DSC = Document Structuring Conventions).</P>
+</BODY>
+</HTML>
\ No newline at end of file

Propchange: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/ps/dsc/package.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/ps/dsc/tools/DSCTools.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/ps/dsc/tools/DSCTools.java?view=auto&rev=512838
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/ps/dsc/tools/DSCTools.java (added)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/ps/dsc/tools/DSCTools.java Wed
Feb 28 08:42:28 2007
@@ -0,0 +1,120 @@
+/*
+ * 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.xmlgraphics.ps.dsc.tools;
+
+import java.io.IOException;
+
+import org.apache.xmlgraphics.ps.DSCConstants;
+import org.apache.xmlgraphics.ps.PSGenerator;
+import org.apache.xmlgraphics.ps.dsc.DSCException;
+import org.apache.xmlgraphics.ps.dsc.DSCParser;
+import org.apache.xmlgraphics.ps.dsc.DSCParserConstants;
+import org.apache.xmlgraphics.ps.dsc.events.DSCComment;
+import org.apache.xmlgraphics.ps.dsc.events.DSCEvent;
+import org.apache.xmlgraphics.ps.dsc.events.DSCHeaderComment;
+import org.apache.xmlgraphics.ps.dsc.events.PostScriptComment;
+
+/**
+ * Helper methods commonly used when dealing with DSC-compliant PostScript files.
+ */
+public class DSCTools implements DSCParserConstants {
+
+    /**
+     * Indicates whether the given event ends a header comment section according to the rules
in
+     * DSC 3.0, chapter 4.4.
+     * @param event the event to check
+     * @return true if a header comment section would be ended either explicitely or implicitely
+     *              by the given event
+     */
+    public static boolean headerCommentsEndHere(DSCEvent event) {
+        switch (event.getEventType()) {
+        case DSC_COMMENT:
+            DSCComment comment = event.asDSCComment();
+            return (comment.getName().equals(DSCConstants.END_COMMENTS));
+        case COMMENT:
+            String s = ((PostScriptComment)event).getComment();
+            if (s == null || s.length() == 0) {
+                return true;
+            } else {
+                char c = s.charAt(0);
+                return ("\n\t ".indexOf(c) >= 0);
+            }
+        default:
+            return true;
+        }
+    }
+
+    /**
+     * Verifies that the file being parsed is a DSC 3.0 file.
+     * @param parser the DSC parser
+     * @return the header comment event
+     * @throws DSCException In case of a violation of the DSC spec
+     * @throws IOException In case of an I/O problem
+     */
+    public static DSCHeaderComment checkAndSkipDSC30Header(DSCParser parser)
+                throws DSCException, IOException {
+        if (!parser.hasNext()) {
+            throw new DSCException("File has no content");
+        }
+        DSCEvent event = parser.nextEvent();
+        if (event.getEventType() == HEADER_COMMENT) {
+            DSCHeaderComment header = (DSCHeaderComment)event;
+            if (!header.isPSAdobe30()) {
+                throw new DSCException("PostScript file does not start with '" 
+                        + DSCConstants.PS_ADOBE_30 + "'");
+            }
+            return header;
+        } else {
+            throw new DSCException("PostScript file does not start with '" 
+                    + DSCConstants.PS_ADOBE_30 + "'");
+        }
+    }
+    
+    /**
+     * Advances the parser to the next page or to the trailer or the end of file comment.
+     * @param parser the DSC parser
+     * @param gen the PSGenerator instance to pass the skipped events through to
+     * @return the DSC comment found (Page, Trailer or EOF)
+     * @throws IOException In case of an I/O error
+     * @throws DSCException In case of a violation of the DSC spec
+     */
+    public static DSCComment nextPageOrTrailer(DSCParser parser, PSGenerator gen)
+                throws IOException, DSCException {
+        while (parser.hasNext()) {
+            DSCEvent event = parser.nextEvent();
+            if (event.getEventType() == DSC_COMMENT) {
+                DSCComment comment = event.asDSCComment();
+                if (DSCConstants.PAGE.equals(comment.getName())) {
+                    return comment;
+                } else if (DSCConstants.TRAILER.equals(comment.getName())) {
+                    return comment;
+                }
+            } else if (event.getEventType() == EOF) {
+                //The Trailer may be missing
+                return event.asDSCComment();
+            }
+            if (gen != null) {
+                event.generate(gen); //Pipe through to PSGenerator
+            }
+        }
+        return null;
+    }
+
+}

Propchange: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/ps/dsc/tools/DSCTools.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/ps/dsc/tools/PageExtractor.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/ps/dsc/tools/PageExtractor.java?view=auto&rev=512838
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/ps/dsc/tools/PageExtractor.java
(added)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/ps/dsc/tools/PageExtractor.java
Wed Feb 28 08:42:28 2007
@@ -0,0 +1,119 @@
+/*
+ * 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.xmlgraphics.ps.dsc.tools;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.apache.xmlgraphics.ps.DSCConstants;
+import org.apache.xmlgraphics.ps.PSGenerator;
+import org.apache.xmlgraphics.ps.dsc.DSCException;
+import org.apache.xmlgraphics.ps.dsc.DSCFilter;
+import org.apache.xmlgraphics.ps.dsc.DSCParser;
+import org.apache.xmlgraphics.ps.dsc.DSCParserConstants;
+import org.apache.xmlgraphics.ps.dsc.DefaultNestedDocumentHandler;
+import org.apache.xmlgraphics.ps.dsc.events.DSCComment;
+import org.apache.xmlgraphics.ps.dsc.events.DSCCommentPage;
+import org.apache.xmlgraphics.ps.dsc.events.DSCCommentPages;
+import org.apache.xmlgraphics.ps.dsc.events.DSCEvent;
+import org.apache.xmlgraphics.ps.dsc.events.DSCHeaderComment;
+
+/**
+ * This class can extract a certain range of pages from a DSC-compliant PostScript file.
+ */
+public class PageExtractor implements DSCParserConstants {
+    
+    /**
+     * Parses a DSC-compliant file and pipes the content through to the OutputStream omitting
+     * all pages not within the range.
+     * @param in the InputStream to parse from 
+     * @param out the OutputStream to write the modified file to
+     * @param from the starting page (1-based)
+     * @param to the last page (inclusive, 1-based)
+     * @throws IOException In case of an I/O error
+     * @throws DSCException In case of a violation of the DSC spec
+     */
+    public static void extractPages(InputStream in, OutputStream out, int from, int to) 
+                throws IOException, DSCException {
+        if (from <= 0) {
+            throw new IllegalArgumentException("'from' page number must be 1 or higher");
+        }
+        if (to < from) {
+            throw new IllegalArgumentException(
+                    "'to' page number must be equal or larger than the 'from' page number");
+        }
+        
+        DSCParser parser = new DSCParser(in);
+        PSGenerator gen = new PSGenerator(out);
+        parser.setNestedDocumentHandler(new DefaultNestedDocumentHandler(gen));
+        int pageCount = 0;
+        
+        //Skip DSC header
+        DSCHeaderComment header = DSCTools.checkAndSkipDSC30Header(parser);
+        header.generate(gen);
+        //Set number of pages
+        DSCCommentPages pages = new DSCCommentPages(to - from + 1);
+        pages.generate(gen);
+
+        parser.setFilter(new DSCFilter() {
+            public boolean accept(DSCEvent event) {
+                if (event.isDSCComment()) {
+                    //Filter %%Pages which we add manually above
+                    return !event.asDSCComment().getName().equals(DSCConstants.PAGES);
+                } else {
+                    return true;
+                }
+            }
+        });
+
+        //Skip the prolog and to the first page
+        DSCComment pageOrTrailer = parser.nextDSCComment(DSCConstants.PAGE, gen);
+        if (pageOrTrailer == null) {
+            throw new DSCException("Page expected, but none found");
+        }
+        parser.setFilter(null); //Remove filter
+        
+        //Process individual pages (and skip as necessary)
+        while (true) {
+            DSCCommentPage page = (DSCCommentPage)pageOrTrailer;
+            boolean validPage = (page.getPagePosition() >= from && page.getPagePosition()
<= to);
+            if (validPage) {
+                page.setPagePosition(page.getPagePosition() - from + 1);
+                page.generate(gen);
+                pageCount++;
+            }
+            pageOrTrailer = DSCTools.nextPageOrTrailer(parser, (validPage ? gen : null));
+            if (pageOrTrailer == null) {
+                throw new DSCException("File is not DSC-compliant: Unexpected end of file");
+            } else if (!DSCConstants.PAGE.equals(pageOrTrailer.getName())) {
+                pageOrTrailer.generate(gen);
+                break;
+            }
+        }
+        
+        //Write the rest
+        while (parser.hasNext()) {
+            DSCEvent event = parser.nextEvent();
+            event.generate(gen);
+        }
+    }
+    
+}
\ No newline at end of file

Propchange: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/ps/dsc/tools/PageExtractor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/ps/dsc/tools/package.html
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/ps/dsc/tools/package.html?view=auto&rev=512838
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/ps/dsc/tools/package.html (added)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/ps/dsc/tools/package.html Wed
Feb 28 08:42:28 2007
@@ -0,0 +1,23 @@
+<!--
+  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$ -->
+<HTML>
+<TITLE>org.apache.xmlgraphics.ps.dsc.tools Package</TITLE>
+<BODY>
+<P>Tools for working with DSC-compliant PostScript files.</P>
+</BODY>
+</HTML>
\ No newline at end of file

Propchange: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/ps/dsc/tools/package.html
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/StandardTestSuite.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/StandardTestSuite.java?view=diff&rev=512838&r1=512837&r2=512838
==============================================================================
--- xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/StandardTestSuite.java (original)
+++ xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/StandardTestSuite.java Wed
Feb 28 08:42:28 2007
@@ -20,6 +20,8 @@
 package org.apache.xmlgraphics;
 
 import org.apache.xmlgraphics.image.codec.png.PNGEncoderTest;
+import org.apache.xmlgraphics.ps.dsc.events.DSCValueParserTestCase;
+import org.apache.xmlgraphics.ps.dsc.tools.DSCToolsTestCase;
 import org.apache.xmlgraphics.util.ServiceTest;
 import org.apache.xmlgraphics.util.io.ASCII85InputStreamTestCase;
 import org.apache.xmlgraphics.util.io.ASCII85OutputStreamTestCase;
@@ -46,6 +48,8 @@
         suite.addTest(new TestSuite(ASCII85OutputStreamTestCase.class));
         suite.addTest(new TestSuite(PNGEncoderTest.class));
         suite.addTest(new TestSuite(ServiceTest.class));
+        suite.addTest(new TestSuite(DSCValueParserTestCase.class));
+        suite.addTest(new TestSuite(DSCToolsTestCase.class));
         //$JUnit-END$
         return suite;
     }

Added: xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/ps/dsc/events/DSCValueParserTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/ps/dsc/events/DSCValueParserTestCase.java?view=auto&rev=512838
==============================================================================
--- xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/ps/dsc/events/DSCValueParserTestCase.java
(added)
+++ xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/ps/dsc/events/DSCValueParserTestCase.java
Wed Feb 28 08:42:28 2007
@@ -0,0 +1,72 @@
+/*
+ * 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.xmlgraphics.ps.dsc.events;
+
+import java.util.List;
+
+import org.apache.xmlgraphics.ps.dsc.events.DSCCommentBeginResource;
+
+import junit.framework.TestCase;
+
+public class DSCValueParserTestCase extends TestCase {
+
+    private String[] toArray(List params) {
+        return (String[])params.toArray(new String[params.size()]);
+    }
+    
+    public void testText() throws Exception {
+        DSCCommentBeginResource obj = new DSCCommentBeginResource();
+        String[] res = toArray(obj.splitParams("procset Test"));
+        assertEquals(2, res.length);
+        assertEquals("procset", res[0]);
+        assertEquals("Test", res[1]);
+
+        res = toArray(obj.splitParams("procset\tTest"));
+        assertEquals(2, res.length);
+        assertEquals("procset", res[0]);
+        assertEquals("Test", res[1]);
+    }
+    
+    public void testParentheseText() throws Exception {
+        DSCCommentBeginResource obj = new DSCCommentBeginResource();
+        String[] res = toArray(obj.splitParams("procset (Hello World!)"));
+        assertEquals(2, res.length);
+        assertEquals("procset", res[0]);
+        assertEquals("Hello World!", res[1]);
+
+        res = toArray(obj.splitParams("procset\t(Hello\t\\\\wonderful/ World!)"));
+        assertEquals(2, res.length);
+        assertEquals("procset", res[0]);
+        assertEquals("Hello\t\\wonderful/ World!", res[1]);
+
+        res = toArray(obj.splitParams("procset (Hello \\042wonderful\\042 World!) blahblah"));
+        assertEquals(3, res.length);
+        assertEquals("procset", res[0]);
+        assertEquals("Hello \"wonderful\" World!", res[1]);
+        assertEquals("blahblah", res[2]);
+
+        //Parentheses not balanced
+        res = toArray(obj.splitParams("procset (Hello (wonderful) World! blahblah"));
+        assertEquals(2, res.length);
+        assertEquals("procset", res[0]);
+        assertEquals("Hello (wonderful) World! blahblah", res[1]);
+    }
+    
+}

Propchange: xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/ps/dsc/events/DSCValueParserTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/ps/dsc/tools/DSCToolsTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/ps/dsc/tools/DSCToolsTestCase.java?view=auto&rev=512838
==============================================================================
--- xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/ps/dsc/tools/DSCToolsTestCase.java
(added)
+++ xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/ps/dsc/tools/DSCToolsTestCase.java
Wed Feb 28 08:42:28 2007
@@ -0,0 +1,57 @@
+/*
+ * 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.xmlgraphics.ps.dsc.tools;
+
+import org.apache.xmlgraphics.ps.dsc.events.DSCCommentEndComments;
+import org.apache.xmlgraphics.ps.dsc.events.DSCCommentPages;
+import org.apache.xmlgraphics.ps.dsc.events.DSCEvent;
+import org.apache.xmlgraphics.ps.dsc.events.PostScriptComment;
+import org.apache.xmlgraphics.ps.dsc.events.PostScriptLine;
+
+import junit.framework.TestCase;
+
+public class DSCToolsTestCase extends TestCase {
+
+    public void testEndComment() throws Exception {
+        DSCEvent event;
+        
+        event = new DSCCommentEndComments();
+        assertTrue(DSCTools.headerCommentsEndHere(event));
+
+        event = new PostScriptComment("FOPTest");
+        assertFalse(DSCTools.headerCommentsEndHere(event));
+
+        event = new DSCCommentPages(7);
+        assertFalse(DSCTools.headerCommentsEndHere(event));
+
+        event = new PostScriptComment(null);
+        assertTrue(DSCTools.headerCommentsEndHere(event));
+
+        event = new PostScriptComment("\t");
+        assertTrue(DSCTools.headerCommentsEndHere(event));
+
+        event = new PostScriptComment(" ***");
+        assertTrue(DSCTools.headerCommentsEndHere(event));
+
+        event = new PostScriptLine("/pgsave save def");
+        assertTrue(DSCTools.headerCommentsEndHere(event));
+    }
+    
+}

Propchange: xmlgraphics/commons/trunk/test/java/org/apache/xmlgraphics/ps/dsc/tools/DSCToolsTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native



---------------------------------------------------------------------
Apache XML Graphics Project URL: http://xmlgraphics.apache.org/
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org


Mime
View raw message