Index: test/fotree/unittests/nested-block.fo
===================================================================
--- test/fotree/unittests/nested-block.fo (revision 0)
+++ test/fotree/unittests/nested-block.fo (revision 0)
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+ Text1
+
+ Text2
+
+
+
+
+
\ No newline at end of file
Property changes on: test\fotree\unittests\nested-block.fo
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Index: test/java/org/apache/fop/fo/FOEventHandlerTestCase.java
===================================================================
--- test/java/org/apache/fop/fo/FOEventHandlerTestCase.java (revision 0)
+++ test/java/org/apache/fop/fo/FOEventHandlerTestCase.java (revision 0)
@@ -0,0 +1,91 @@
+/*
+ * 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.fop.fo;
+
+import java.io.File;
+
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.sax.SAXResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.apps.Fop;
+import org.apache.fop.apps.FopFactory;
+import org.apache.fop.fo.flow.Block;
+import org.apache.fop.fotreetest.FOTreeUnitTester;
+
+/**
+ * Tests for FOEventHandler.
+ */
+public class FOEventHandlerTestCase extends FOTreeUnitTester {
+
+ public FOEventHandlerTestCase() throws Exception {
+ super();
+ }
+
+ public void testCallSequenceForBlock() throws Exception {
+ FopFactory fopFactory = FopFactory.newInstance();
+ FOUserAgent ua = fopFactory.newFOUserAgent();
+ CallSequenceFOEventHandler handler = new CallSequenceFOEventHandler(ua);
+ ua.setFOEventHandlerOverride(handler);
+ Fop fop = fopFactory.newFop(ua);
+
+ File baseDir = new File("test/fotree/unittests");
+ File foFile = new File(baseDir, "nested-block.fo");
+
+ TransformerFactory tFactory = TransformerFactory.newInstance();
+ Transformer transformer = tFactory.newTransformer();
+ StreamSource src = new StreamSource(foFile);
+ SAXResult res = new SAXResult(fop.getDefaultHandler());
+ transformer.transform(src, res);
+
+ assertEquals("Text1Text2", handler.log.toString());
+ }
+
+ private static class CallSequenceFOEventHandler extends FOEventHandler {
+
+ private StringBuffer log = new StringBuffer();
+
+ public CallSequenceFOEventHandler(FOUserAgent ua) {
+ super(ua);
+ }
+
+ /** {@inheritDoc} */
+ public void characters(char[] data, int start, int length) {
+ System.out.println(new String(data, start, length));
+ log.append(data, start, length);
+ }
+
+ /** {@inheritDoc} */
+ public void startBlock(Block bl) {
+ System.out.println("startBlock");
+ log.append("");
+ }
+
+ /** {@inheritDoc} */
+ public void endBlock(Block bl) {
+ System.out.println("endBlock");
+ log.append("");
+ }
+
+ }
+
+}
Property changes on: test\java\org\apache\fop\fo\FOEventHandlerTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native