KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > fop > render > pdf > PDFCMapTestCase


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17
18 /* $Id: PDFCMap.java 426576 2006-07-28 15:44:37Z jeremias $ */
19
20 package org.apache.fop.render.pdf;
21
22 import org.apache.fop.pdf.PDFCMap;
23
24 import junit.framework.TestCase;
25
26 /** Simple sanity test of the PDFCmap class */
27 public class PDFCMapTestCase extends TestCase {
28     
29     public void testPDFCMapFillInPDF() {
30         final String JavaDoc EOL = "\n";
31         final String JavaDoc expected =
32             "%!PS-Adobe-3.0 Resource-CMap" + EOL
33             +"%%DocumentNeededResources: ProcSet (CIDInit)" + EOL
34             +"%%IncludeResource: ProcSet (CIDInit)" + EOL
35             +"%%BeginResource: CMap (test)" + EOL
36             +"%%EndComments" + EOL
37             +"/CIDInit /ProcSet findresource begin" + EOL
38             +"12 dict begin" + EOL
39             +"begincmap" + EOL
40             +"/CIDSystemInfo 3 dict dup begin" + EOL
41             +" /Registry (Adobe) def" + EOL
42             +" /Ordering (Identity) def" + EOL
43             +" /Supplement 0 def" + EOL
44             +"end def" + EOL
45             +"/CMapVersion 1 def" + EOL
46             +"/CMapType 1 def" + EOL
47             +"/CMapName /test def" + EOL
48             +"1 begincodespacerange" + EOL
49             +"<0000> <FFFF>" + EOL
50             +"endcodespacerange" + EOL
51             +"1 begincidrange" + EOL
52             +"<0000> <FFFF> 0" + EOL
53             +"endcidrange" + EOL
54             +"endcmap" + EOL
55             +"CMapName currentdict /CMap defineresource pop" + EOL
56             +"end" + EOL
57             +"end" + EOL
58             +"%%EndResource" + EOL
59             +"%%EOF" + EOL
60         ;
61         
62         final PDFCMap m = new PDFCMap("test", null);
63         final StringBuffer JavaDoc b = new StringBuffer JavaDoc();
64         m.fillInPDF(b);
65         final String JavaDoc actual = b.toString();
66         assertEquals("PDFCMap output matches expected PostScript code", expected, actual);
67     }
68
69 }
70
Popular Tags