1 2 17 18 19 package org.apache.poi.hwpf.model; 20 21 import junit.framework.*; 22 import org.apache.poi.hwpf.*; 23 import org.apache.poi.hwpf.model.io.*; 24 25 import java.io.*; 26 import java.util.*; 27 28 public class TestFontTable 29 extends TestCase 30 { 31 private FontTable _fontTable = null; 32 private HWPFDocFixture _hWPFDocFixture; 33 34 public TestFontTable(String name) 35 { 36 super(name); 37 } 38 39 public void testReadWrite() 40 throws Exception 41 { 42 FileInformationBlock fib = _hWPFDocFixture._fib; 43 byte[] tableStream = _hWPFDocFixture._tableStream; 44 45 int fcSttbfffn = fib.getFcSttbfffn(); 46 int lcbSttbfffn = fib.getLcbSttbfffn(); 47 48 _fontTable = new FontTable(tableStream, fcSttbfffn, lcbSttbfffn); 49 50 HWPFFileSystem fileSys = new HWPFFileSystem(); 51 52 _fontTable.writeTo(fileSys); 53 HWPFOutputStream tableOut = fileSys.getStream("1Table"); 54 55 56 byte[] newTableStream = tableOut.toByteArray(); 57 58 59 FontTable newFontTable = new FontTable(newTableStream, 0, newTableStream.length); 60 61 assertTrue(_fontTable.equals(newFontTable)); 62 63 } 64 65 protected void setUp() 66 throws Exception 67 { 68 super.setUp(); 69 70 _hWPFDocFixture = new HWPFDocFixture(this); 71 72 _hWPFDocFixture.setUp(); 73 } 74 75 protected void tearDown() 76 throws Exception 77 { 78 _hWPFDocFixture.tearDown(); 79 80 _hWPFDocFixture = null; 81 super.tearDown(); 82 } 83 84 } 85 86 | Popular Tags |