summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/java/org/apache/fop/fonts/EmbedFontInfoTestCase.java2
-rw-r--r--test/java/org/apache/fop/fonts/FontsTestSuite.java2
-rw-r--r--test/java/org/apache/fop/pdf/PDFDestsTestCase.java2
-rw-r--r--test/java/org/apache/fop/pdf/PDFDictionaryTestCase.java2
-rw-r--r--test/java/org/apache/fop/pdf/PDFPageLabelsTestCase.java28
-rw-r--r--test/java/org/apache/fop/pdf/PDFStreamTestCase.java2
-rw-r--r--test/java/org/apache/fop/pdf/xref/CrossReferenceTableTestCase.java2
-rw-r--r--test/java/org/apache/fop/render/intermediate/AbstractIFPainterTestCase.java2
-rw-r--r--test/layoutengine/standard-testcases/pdf-dictionary-extension_2.xml74
-rw-r--r--test/layoutengine/standard-testcases/pdf-dictionary-extension_3.xml122
10 files changed, 218 insertions, 20 deletions
diff --git a/test/java/org/apache/fop/fonts/EmbedFontInfoTestCase.java b/test/java/org/apache/fop/fonts/EmbedFontInfoTestCase.java
index d156b908c..ee3498a03 100644
--- a/test/java/org/apache/fop/fonts/EmbedFontInfoTestCase.java
+++ b/test/java/org/apache/fop/fonts/EmbedFontInfoTestCase.java
@@ -35,6 +35,8 @@ import static org.junit.Assert.assertTrue;
*/
public class EmbedFontInfoTestCase {
+ public EmbedFontInfoTestCase() {}
+
private EmbedFontInfo sut;
private final URI metricsURI = URI.create("test/resources/fonts/ttf/glb12.ttf.xml");
diff --git a/test/java/org/apache/fop/fonts/FontsTestSuite.java b/test/java/org/apache/fop/fonts/FontsTestSuite.java
index ad48c46c4..1baba49df 100644
--- a/test/java/org/apache/fop/fonts/FontsTestSuite.java
+++ b/test/java/org/apache/fop/fonts/FontsTestSuite.java
@@ -29,7 +29,7 @@ import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
@SuiteClasses({
FontManagerConfiguratorTestCase.class,
- EmbedFontInfo.class,
+ EmbedFontInfoTestCase.class,
FontEventProcessingTestCase.class,
FontManagerConfiguratorTestCase.class
})
diff --git a/test/java/org/apache/fop/pdf/PDFDestsTestCase.java b/test/java/org/apache/fop/pdf/PDFDestsTestCase.java
index 08d841ede..49c1e6dab 100644
--- a/test/java/org/apache/fop/pdf/PDFDestsTestCase.java
+++ b/test/java/org/apache/fop/pdf/PDFDestsTestCase.java
@@ -32,7 +32,7 @@ import java.util.List;
public class PDFDestsTestCase extends PDFObjectTestCase {
private PDFDests dests = new PDFDests();
- private String expectedString = "<< /Names [(number) 10 (name) /Test#20name] >>\n";
+ private String expectedString = "<< /Names [(number) 10 (name) /Test#20name] >>";
@Before
public void setUp() {
diff --git a/test/java/org/apache/fop/pdf/PDFDictionaryTestCase.java b/test/java/org/apache/fop/pdf/PDFDictionaryTestCase.java
index 3f84fac2e..00224e93e 100644
--- a/test/java/org/apache/fop/pdf/PDFDictionaryTestCase.java
+++ b/test/java/org/apache/fop/pdf/PDFDictionaryTestCase.java
@@ -47,7 +47,7 @@ public class PDFDictionaryTestCase extends PDFObjectTestCase {
+ " /array [1 (two) 20]\n"
+ " /number 20\n"
+ " /null null\n"
- + ">>\n";
+ + ">>";
@Before
public void setUp() {
diff --git a/test/java/org/apache/fop/pdf/PDFPageLabelsTestCase.java b/test/java/org/apache/fop/pdf/PDFPageLabelsTestCase.java
index e982bf246..a8be7ee74 100644
--- a/test/java/org/apache/fop/pdf/PDFPageLabelsTestCase.java
+++ b/test/java/org/apache/fop/pdf/PDFPageLabelsTestCase.java
@@ -37,11 +37,11 @@ public class PDFPageLabelsTestCase {
int index = 0;
StringBuilder expected = new StringBuilder();
expected.append("[");
- expected.append(index + " << /S /r >>\n");
+ expected.append(index + " << /S /r >>");
pageLabels.addPageLabel(index++, "i");
pageLabels.addPageLabel(index++, "ii");
pageLabels.addPageLabel(index++, "iii");
- expected.append(" " + index + " << /S /D >>\n");
+ expected.append(" " + index + " << /S /D >>");
pageLabels.addPageLabel(index++, "1");
pageLabels.addPageLabel(index++, "2");
pageLabels.addPageLabel(index++, "3");
@@ -52,33 +52,33 @@ public class PDFPageLabelsTestCase {
pageLabels.addPageLabel(index++, "8");
pageLabels.addPageLabel(index++, "9");
pageLabels.addPageLabel(index++, "10");
- expected.append(" " + index + " << /S /A >>\n");
+ expected.append(" " + index + " << /S /A >>");
pageLabels.addPageLabel(index++, "A");
pageLabels.addPageLabel(index++, "B");
- expected.append(" " + index + " << /S /R /St 100 >>\n");
+ expected.append(" " + index + " << /S /R /St 100 >>");
pageLabels.addPageLabel(index++, "C");
- expected.append(" " + index + " << /S /R /St 500 >>\n");
+ expected.append(" " + index + " << /S /R /St 500 >>");
pageLabels.addPageLabel(index++, "D");
- expected.append(" " + index + " << /S /A /St 5 >>\n");
+ expected.append(" " + index + " << /S /A /St 5 >>");
pageLabels.addPageLabel(index++, "E");
pageLabels.addPageLabel(index++, "F");
pageLabels.addPageLabel(index++, "G");
- expected.append(" " + index + " << /P (aa) >>\n");
+ expected.append(" " + index + " << /P (aa) >>");
pageLabels.addPageLabel(index++, "aa");
- expected.append(" " + index + " << /P (ab) >>\n");
+ expected.append(" " + index + " << /P (ab) >>");
pageLabels.addPageLabel(index++, "ab");
- expected.append(" " + index + " << /P (ac) >>\n");
+ expected.append(" " + index + " << /P (ac) >>");
pageLabels.addPageLabel(index++, "ac");
- expected.append(" " + index + " << /S /a >>\n");
+ expected.append(" " + index + " << /S /a >>");
pageLabels.addPageLabel(index++, "a");
pageLabels.addPageLabel(index++, "b");
- expected.append(" " + index + " << /S /R /St 2 >>\n");
+ expected.append(" " + index + " << /S /R /St 2 >>");
pageLabels.addPageLabel(index++, "II");
- expected.append(" " + index + " << /S /R /St 12 >>\n");
+ expected.append(" " + index + " << /S /R /St 12 >>");
pageLabels.addPageLabel(index++, "XII");
- expected.append(" " + index + " <<\n /P (00)\n /S /D\n /St 9\n>>\n");
+ expected.append(" " + index + " <<\n /P (00)\n /S /D\n /St 9\n>>");
pageLabels.addPageLabel(index++, "009");
- expected.append(" " + index + " <<\n /P (0)\n /S /D\n /St 10\n>>\n");
+ expected.append(" " + index + " <<\n /P (0)\n /S /D\n /St 10\n>>");
pageLabels.addPageLabel(index++, "010");
pageLabels.addPageLabel(index++, "011");
expected.append("]");
diff --git a/test/java/org/apache/fop/pdf/PDFStreamTestCase.java b/test/java/org/apache/fop/pdf/PDFStreamTestCase.java
index 93dcea511..20e38a600 100644
--- a/test/java/org/apache/fop/pdf/PDFStreamTestCase.java
+++ b/test/java/org/apache/fop/pdf/PDFStreamTestCase.java
@@ -118,7 +118,7 @@ public class PDFStreamTestCase {
private byte[] createSampleStreamData() throws IOException {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
- stream.write("stream\n".getBytes("US-ASCII"));
+ stream.write("\nstream\n".getBytes("US-ASCII"));
stream.write(createSampleData());
stream.write("\nendstream".getBytes("US-ASCII"));
return stream.toByteArray();
diff --git a/test/java/org/apache/fop/pdf/xref/CrossReferenceTableTestCase.java b/test/java/org/apache/fop/pdf/xref/CrossReferenceTableTestCase.java
index ceff96a91..12f6e3c1b 100644
--- a/test/java/org/apache/fop/pdf/xref/CrossReferenceTableTestCase.java
+++ b/test/java/org/apache/fop/pdf/xref/CrossReferenceTableTestCase.java
@@ -73,7 +73,7 @@ public class CrossReferenceTableTestCase extends CrossReferenceObjectTest {
.append(" /Info 2 0 R\n")
.append(" /ID [<0123456789ABCDEF> <0123456789ABCDEF>]\n")
.append(" /Size ").append(Integer.toString(offsets.size() + 1)).append('\n')
- .append(">>\n");
+ .append(">>");
return getBytes(expected);
}
diff --git a/test/java/org/apache/fop/render/intermediate/AbstractIFPainterTestCase.java b/test/java/org/apache/fop/render/intermediate/AbstractIFPainterTestCase.java
index 592335648..be8b5d718 100644
--- a/test/java/org/apache/fop/render/intermediate/AbstractIFPainterTestCase.java
+++ b/test/java/org/apache/fop/render/intermediate/AbstractIFPainterTestCase.java
@@ -51,7 +51,7 @@ public class AbstractIFPainterTestCase {
public void endViewport() throws IFException {
}
- public void startGroup(AffineTransform transform) throws IFException {
+ public void startGroup(AffineTransform transform, String layer) throws IFException {
}
public void endGroup() throws IFException {
diff --git a/test/layoutengine/standard-testcases/pdf-dictionary-extension_2.xml b/test/layoutengine/standard-testcases/pdf-dictionary-extension_2.xml
new file mode 100644
index 000000000..486b8601c
--- /dev/null
+++ b/test/layoutengine/standard-testcases/pdf-dictionary-extension_2.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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$ -->
+<testcase>
+ <info>
+ <p>
+ This test checks the PDF dictionary extensions related to optional content groups (layers).
+ </p>
+ </info>
+ <fo>
+ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf"
+ xmlns:fox="http://xmlgraphics.apache.org/fop/extensions">
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="simple">
+ <fo:region-body/>
+ <fo:region-before/>
+ <fo:region-after/>
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+ <fo:declarations>
+ <!-- Optional Content Group Layers -->
+ <pdf:layer id="layer1">
+ <pdf:string key="Name">Bullet 1</pdf:string>
+ </pdf:layer>
+ <pdf:layer id="layer2">
+ <pdf:string key="Name">Bullet 2</pdf:string>
+ </pdf:layer>
+ <!-- Document Catalog's Optional Content (Layers) Directory and Default State -->
+ <pdf:catalog>
+ <pdf:dictionary key="OCProperties">
+ <!-- Directory of OCGs (layers) in Document -->
+ <pdf:array key="OCGs">
+ <pdf:reference refid="layer1"/>
+ <pdf:reference refid="layer2"/>
+ </pdf:array>
+ <!-- Default State for OCGs -->
+ <pdf:dictionary key="D">
+ <pdf:string key="Name">Default</pdf:string>
+ <pdf:name key="BaseState">OFF</pdf:name>
+ </pdf:dictionary>
+ </pdf:dictionary>
+ </pdf:catalog>
+ </fo:declarations>
+ <fo:page-sequence master-reference="simple">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:block fox:layer="layer1">
+ <fo:block>BULLET 1A</fo:block>
+ <fo:block>BULLET 1B</fo:block>
+ </fo:block>
+ <fo:block fox:layer="layer2">BULLET 2</fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+ </fo:root>
+ </fo>
+ <checks xmlns:pdf="apache:fop:extensions:pdf">
+ <eval expected="layer1" xpath="//flow/block[1]/@layer"/>
+ <eval expected="layer2" xpath="//flow/block[2]/@layer"/>
+ </checks>
+</testcase>
diff --git a/test/layoutengine/standard-testcases/pdf-dictionary-extension_3.xml b/test/layoutengine/standard-testcases/pdf-dictionary-extension_3.xml
new file mode 100644
index 000000000..ee5061497
--- /dev/null
+++ b/test/layoutengine/standard-testcases/pdf-dictionary-extension_3.xml
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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$ -->
+<testcase>
+ <info>
+ <p>
+ This test checks the PDF dictionary extensions related to optional content groups (layers),
+ including navigator and action dictionaries.
+ </p>
+ </info>
+ <fo>
+ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf"
+ xmlns:fox="http://xmlgraphics.apache.org/fop/extensions">
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="simple">
+ <fo:region-body/>
+ <fo:region-before/>
+ <fo:region-after/>
+ <!-- Initial Layers Navigation Node for Page 1 -->
+ <pdf:page page-numbers="1">
+ <pdf:reference key="PresSteps" refid="navInitial"/>
+ </pdf:page>
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+ <fo:declarations>
+ <!-- Optional Content Group Layers -->
+ <pdf:layer id="layer1">
+ <pdf:string key="Name">Bullet 1</pdf:string>
+ </pdf:layer>
+ <pdf:layer id="layer2">
+ <pdf:string key="Name">Bullet 2</pdf:string>
+ </pdf:layer>
+ <!-- Navigator Actions -->
+ <pdf:action type="SetOCGState" id="setStateInitial">
+ <pdf:array key="State">
+ <pdf:name>OFF</pdf:name>
+ <pdf:reference refid="layer1"/>
+ <pdf:reference refid="layer2"/>
+ </pdf:array>
+ </pdf:action>
+ <pdf:action type="SetOCGState" id="setStateBullet1">
+ <pdf:array key="State">
+ <pdf:name>OFF</pdf:name>
+ <pdf:reference refid="layer2"/>
+ <pdf:name>ON</pdf:name>
+ <pdf:reference refid="layer1"/>
+ </pdf:array>
+ </pdf:action>
+ <pdf:action type="SetOCGState" id="setStateBullet2">
+ <pdf:array key="State">
+ <pdf:name>OFF</pdf:name>
+ <pdf:reference refid="layer1"/>
+ <pdf:name>ON</pdf:name>
+ <pdf:reference refid="layer2"/>
+ </pdf:array>
+ </pdf:action>
+ <!-- Navigators -->
+ <pdf:navigator id="navInitial">
+ <pdf:reference key="NA" refid="setStateBullet1"/>
+ <pdf:reference key="Next" refid="navBullet1"/>
+ <pdf:reference key="PA" refid="setStateInitial"/>
+ <pdf:reference key="Prev" refid="navInitial"/>
+ </pdf:navigator>
+ <pdf:navigator id="navBullet1">
+ <pdf:reference key="NA" refid="setStateBullet2"/>
+ <pdf:reference key="Next" refid="navBullet2"/>
+ <pdf:reference key="PA" refid="setStateInitial"/>
+ <pdf:reference key="Prev" refid="navInitial"/>
+ </pdf:navigator>
+ <pdf:navigator id="navBullet2">
+ <pdf:reference key="NA" refid="setStateBullet2"/>
+ <pdf:reference key="Next" refid="navBullet2"/>
+ <pdf:reference key="PA" refid="setStateBullet1"/>
+ <pdf:reference key="Prev" refid="navBullet1"/>
+ </pdf:navigator>
+ <!-- Document Catalog's Optional Content (Layers) Directory and Default State -->
+ <pdf:catalog>
+ <pdf:dictionary key="OCProperties">
+ <!-- Directory of OCGs (layers) in Document -->
+ <pdf:array key="OCGs">
+ <pdf:reference refid="layer1"/>
+ <pdf:reference refid="layer2"/>
+ </pdf:array>
+ <!-- Default State for OCGs -->
+ <pdf:dictionary key="D">
+ <pdf:string key="Name">Default</pdf:string>
+ <pdf:name key="BaseState">OFF</pdf:name>
+ </pdf:dictionary>
+ </pdf:dictionary>
+ </pdf:catalog>
+ </fo:declarations>
+ <fo:page-sequence master-reference="simple">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:block fox:layer="layer1">
+ <fo:block>BULLET 1A</fo:block>
+ <fo:block>BULLET 1B</fo:block>
+ </fo:block>
+ <fo:block fox:layer="layer2">BULLET 2</fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+ </fo:root>
+ </fo>
+ <checks xmlns:pdf="apache:fop:extensions:pdf">
+ <eval expected="layer1" xpath="//flow/block[1]/@layer"/>
+ <eval expected="layer2" xpath="//flow/block[2]/@layer"/>
+ </checks>
+</testcase>