From 195512bfcdb6a5d1500a8e01e9327194c9548c93 Mon Sep 17 00:00:00 2001 From: Said Ryan Ackley Date: Thu, 10 Jul 2003 12:25:46 +0000 Subject: [PATCH] nother test git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353203 13f79535-47bb-0310-9956-ffa450edef68 --- .../model/hdftypes/TestTextPieceTable.java | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 src/scratchpad/testcases/org/apache/poi/hwpf/model/hdftypes/TestTextPieceTable.java 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(); + } + +} -- 2.39.5