1 2 17 18 package org.apache.poi.hwpf.model; 19 20 import junit.framework.*; 21 import org.apache.poi.hwpf.*; 22 import org.apache.poi.hwpf.model.io.*; 23 24 import java.io.*; 25 import java.util.*; 26 27 28 public class TestListTables 29 extends HWPFTestCase 30 { 31 32 public TestListTables() 33 { 34 } 35 36 public void testReadWrite() 37 throws Exception 38 { 39 FileInformationBlock fib = _hWPFDocFixture._fib; 40 byte[] tableStream = _hWPFDocFixture._tableStream; 41 42 int listOffset = fib.getFcPlcfLst(); 43 int lfoOffset = fib.getFcPlfLfo(); 44 if (listOffset != 0 && fib.getLcbPlcfLst() != 0) 45 { 46 ListTables listTables = new ListTables (tableStream, fib.getFcPlcfLst (), 47 fib.getFcPlfLfo ()); 48 HWPFFileSystem fileSys = new HWPFFileSystem (); 49 50 HWPFOutputStream tableOut = fileSys.getStream ("1Table"); 51 52 listTables.writeListDataTo (tableOut); 53 int offset = tableOut.getOffset (); 54 listTables.writeListOverridesTo (tableOut); 55 56 ListTables newTables = new ListTables (tableOut.toByteArray (), 0, offset); 57 58 assertEquals(listTables, newTables); 59 60 } 61 } 62 63 } 64 | Popular Tags |