From: Said Ryan Ackley Date: Thu, 10 Jul 2003 12:25:46 +0000 (+0000) Subject: nother test X-Git-Tag: PERF_BEFORE_MERGE~268 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=195512bfcdb6a5d1500a8e01e9327194c9548c93;p=poi.git nother test git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353203 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/model/hdftypes/TestTextPieceTable.java b/src/scratchpad/testcases/org/apache/poi/hwpf/model/hdftypes/TestTextPieceTable.java new file mode 100644 index 0000000000..18987780fd --- /dev/null +++ b/src/scratchpad/testcases/org/apache/poi/hwpf/model/hdftypes/TestTextPieceTable.java @@ -0,0 +1,69 @@ +package org.apache.poi.hwpf.model.hdftypes; + +import junit.framework.*; + +import java.io.ByteArrayOutputStream; +import java.util.ArrayList; + +import org.apache.poi.hwpf.*; +import org.apache.poi.hwpf.model.io.*; + + +public class TestTextPieceTable + extends TestCase +{ + private HWPFDocFixture _hWPFDocFixture; + + public TestTextPieceTable(String name) + { + super(name); + } + + public void testReadWrite() + throws Exception + { + FileInformationBlock fib = _hWPFDocFixture._fib; + byte[] mainStream = _hWPFDocFixture._mainStream; + byte[] tableStream = _hWPFDocFixture._tableStream; + int fcMin = fib.getFcMin(); + + ComplexFileTable cft = new ComplexFileTable(mainStream, tableStream, fib.getFcClx(), fcMin); + + + HWPFFileSystem fileSys = new HWPFFileSystem(); + + cft.writeTo(fileSys); + ByteArrayOutputStream tableOut = fileSys.getStream("1Table"); + ByteArrayOutputStream mainOut = fileSys.getStream("WordDocument"); + + byte[] newTableStream = tableOut.toByteArray(); + byte[] newMainStream = mainOut.toByteArray(); + + ComplexFileTable newCft = new ComplexFileTable(newMainStream, newTableStream, 0,0); + + TextPieceTable oldTextPieceTable = cft.getTextPieceTable(); + TextPieceTable newTextPieceTable = newCft.getTextPieceTable(); + + assertEquals(oldTextPieceTable, newTextPieceTable); + + + } + protected void setUp() + throws Exception + { + super.setUp(); + + _hWPFDocFixture = new HWPFDocFixture(this); + _hWPFDocFixture.setUp(); + } + + protected void tearDown() + throws Exception + { + _hWPFDocFixture.tearDown(); + + _hWPFDocFixture = null; + super.tearDown(); + } + +}