From 2e4ecba6d948c735e8a096a6746321dfe5091f8b Mon Sep 17 00:00:00 2001 From: Said Ryan Ackley Date: Wed, 3 Mar 2004 03:11:20 +0000 Subject: [PATCH] git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353527 13f79535-47bb-0310-9956-ffa450edef68 --- .../hwpf/model/hdftypes/TestCHPBinTable.java | 131 ----------------- .../hdftypes/TestDocumentProperties.java | 75 ---------- .../hdftypes/TestFileInformationBlock.java | 60 -------- .../hwpf/model/hdftypes/TestFontTable.java | 121 ---------------- .../hwpf/model/hdftypes/TestPAPBinTable.java | 134 ------------------ .../hwpf/model/hdftypes/TestPlexOfCps.java | 122 ---------------- .../hwpf/model/hdftypes/TestSectionTable.java | 131 ----------------- .../hwpf/model/hdftypes/TestStyleSheet.java | 118 --------------- .../model/hdftypes/TestTextPieceTable.java | 69 --------- 9 files changed, 961 deletions(-) delete mode 100644 src/scratchpad/testcases/org/apache/poi/hwpf/model/hdftypes/TestCHPBinTable.java delete mode 100644 src/scratchpad/testcases/org/apache/poi/hwpf/model/hdftypes/TestDocumentProperties.java delete mode 100644 src/scratchpad/testcases/org/apache/poi/hwpf/model/hdftypes/TestFileInformationBlock.java delete mode 100644 src/scratchpad/testcases/org/apache/poi/hwpf/model/hdftypes/TestFontTable.java delete mode 100644 src/scratchpad/testcases/org/apache/poi/hwpf/model/hdftypes/TestPAPBinTable.java delete mode 100644 src/scratchpad/testcases/org/apache/poi/hwpf/model/hdftypes/TestPlexOfCps.java delete mode 100644 src/scratchpad/testcases/org/apache/poi/hwpf/model/hdftypes/TestSectionTable.java delete mode 100644 src/scratchpad/testcases/org/apache/poi/hwpf/model/hdftypes/TestStyleSheet.java delete 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/TestCHPBinTable.java b/src/scratchpad/testcases/org/apache/poi/hwpf/model/hdftypes/TestCHPBinTable.java deleted file mode 100644 index 7f72188cba..0000000000 --- a/src/scratchpad/testcases/org/apache/poi/hwpf/model/hdftypes/TestCHPBinTable.java +++ /dev/null @@ -1,131 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2003 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" and - * "Apache POI" must not be used to endorse or promote products - * derived from this software without prior written permission. For - * written permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * "Apache POI", nor may "Apache" appear in their name, without - * prior written permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - -package org.apache.poi.hwpf.model.hdftypes; - -import java.io.ByteArrayOutputStream; -import java.util.ArrayList; - -import junit.framework.*; - -import org.apache.poi.hwpf.*; -import org.apache.poi.hwpf.model.io.*; - -public class TestCHPBinTable - extends TestCase -{ - private CHPBinTable _cHPBinTable = null; - private HWPFDocFixture _hWPFDocFixture; - - public TestCHPBinTable(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(); - - _cHPBinTable = new CHPBinTable(mainStream, tableStream, fib.getFcPlcfbteChpx(), fib.getLcbPlcfbteChpx(), fcMin); - - HWPFFileSystem fileSys = new HWPFFileSystem(); - - _cHPBinTable.writeTo(fileSys, 0); - ByteArrayOutputStream tableOut = fileSys.getStream("1Table"); - ByteArrayOutputStream mainOut = fileSys.getStream("WordDocument"); - - byte[] newTableStream = tableOut.toByteArray(); - byte[] newMainStream = mainOut.toByteArray(); - - CHPBinTable newBinTable = new CHPBinTable(newMainStream, newTableStream, 0, newTableStream.length, 0); - - ArrayList oldTextRuns = _cHPBinTable._textRuns; - ArrayList newTextRuns = newBinTable._textRuns; - - assertEquals(oldTextRuns.size(), newTextRuns.size()); - - int size = oldTextRuns.size(); - for (int x = 0; x < size; x++) - { - PropertyNode oldNode = (PropertyNode)oldTextRuns.get(x); - PropertyNode newNode = (PropertyNode)newTextRuns.get(x); - - assertTrue(oldNode.equals(newNode)); - } - - } - protected void setUp() - throws Exception - { - super.setUp(); - _hWPFDocFixture = new HWPFDocFixture(this); - - _hWPFDocFixture.setUp(); - } - - protected void tearDown() - throws Exception - { - _cHPBinTable = null; - _hWPFDocFixture.tearDown(); - - _hWPFDocFixture = null; - super.tearDown(); - } - -} diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/model/hdftypes/TestDocumentProperties.java b/src/scratchpad/testcases/org/apache/poi/hwpf/model/hdftypes/TestDocumentProperties.java deleted file mode 100644 index 5e08844cee..0000000000 --- a/src/scratchpad/testcases/org/apache/poi/hwpf/model/hdftypes/TestDocumentProperties.java +++ /dev/null @@ -1,75 +0,0 @@ -package org.apache.poi.hwpf.model.hdftypes; - -import junit.framework.*; -import org.apache.poi.hwpf.*; - -import java.lang.reflect.*; -import java.util.Arrays; - -public class TestDocumentProperties - extends TestCase -{ - private DocumentProperties _documentProperties = null; - private HWPFDocFixture _hWPFDocFixture; - - public TestDocumentProperties(String name) - { - super(name); - } - - - public void testReadWrite() - throws Exception - { - int size = _documentProperties.getSize(); - byte[] buf = new byte[size]; - - _documentProperties.serialize(buf, 0); - - DocumentProperties newDocProperties = - new DocumentProperties(buf, 0); - - Field[] fields = DocumentProperties.class.getSuperclass().getDeclaredFields(); - AccessibleObject.setAccessible(fields, true); - - for (int x = 0; x < fields.length; x++) - { - if (!fields[x].getType().isArray()) - { - assertEquals(fields[x].get(_documentProperties), - fields[x].get(newDocProperties)); - } - else - { - byte[] buf1 = (byte[])fields[x].get(_documentProperties); - byte[] buf2 = (byte[])fields[x].get(newDocProperties); - Arrays.equals(buf1, buf2); - } - } - - } - - protected void setUp() - throws Exception - { - super.setUp(); - /**@todo verify the constructors*/ - - _hWPFDocFixture = new HWPFDocFixture(this); - - _hWPFDocFixture.setUp(); - - _documentProperties = new DocumentProperties(_hWPFDocFixture._tableStream, _hWPFDocFixture._fib.getFcDop()); - } - - protected void tearDown() - throws Exception - { - _documentProperties = null; - _hWPFDocFixture.tearDown(); - - _hWPFDocFixture = null; - super.tearDown(); - } - -} diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/model/hdftypes/TestFileInformationBlock.java b/src/scratchpad/testcases/org/apache/poi/hwpf/model/hdftypes/TestFileInformationBlock.java deleted file mode 100644 index 0c441ebc5d..0000000000 --- a/src/scratchpad/testcases/org/apache/poi/hwpf/model/hdftypes/TestFileInformationBlock.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.apache.poi.hwpf.model.hdftypes; - -import junit.framework.*; -import org.apache.poi.hwpf.*; - -import java.lang.reflect.*; - -public class TestFileInformationBlock - extends TestCase -{ - private FileInformationBlock _fileInformationBlock = null; - private HWPFDocFixture _hWPFDocFixture; - - public TestFileInformationBlock(String name) - { - super(name); - } - - public void testReadWrite() - throws Exception - { - int size = _fileInformationBlock.getSize(); - byte[] buf = new byte[size]; - - _fileInformationBlock.serialize(buf, 0); - - FileInformationBlock newFileInformationBlock = - new FileInformationBlock(buf); - - Field[] fields = FileInformationBlock.class.getSuperclass().getDeclaredFields(); - AccessibleObject.setAccessible(fields, true); - - for (int x = 0; x < fields.length; x++) - { - assertEquals(fields[x].get(_fileInformationBlock), fields[x].get(newFileInformationBlock)); - } - } - - protected void setUp() - throws Exception - { - super.setUp(); - /**@todo verify the constructors*/ - _hWPFDocFixture = new HWPFDocFixture(this); - - _hWPFDocFixture.setUp(); - _fileInformationBlock = _hWPFDocFixture._fib; - } - - protected void tearDown() - throws Exception - { - _fileInformationBlock = null; - _hWPFDocFixture.tearDown(); - - _hWPFDocFixture = null; - super.tearDown(); - } - -} diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/model/hdftypes/TestFontTable.java b/src/scratchpad/testcases/org/apache/poi/hwpf/model/hdftypes/TestFontTable.java deleted file mode 100644 index e17e07808b..0000000000 --- a/src/scratchpad/testcases/org/apache/poi/hwpf/model/hdftypes/TestFontTable.java +++ /dev/null @@ -1,121 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2003 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" and - * "Apache POI" must not be used to endorse or promote products - * derived from this software without prior written permission. For - * written permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * "Apache POI", nor may "Apache" appear in their name, without - * prior written permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - -package org.apache.poi.hwpf.model.hdftypes; - -import junit.framework.*; -import org.apache.poi.hwpf.*; -import org.apache.poi.hwpf.model.io.*; - -import java.io.*; -import java.util.*; - -public class TestFontTable - extends TestCase -{ - private FontTable _fontTable = null; - private HWPFDocFixture _hWPFDocFixture; - - public TestFontTable(String name) - { - super(name); - } - - public void testReadWrite() - throws Exception - { - FileInformationBlock fib = _hWPFDocFixture._fib; - byte[] tableStream = _hWPFDocFixture._tableStream; - - int fcSttbfffn = fib.getFcSttbfffn(); - int lcbSttbfffn = fib.getLcbSttbfffn(); - - _fontTable = new FontTable(tableStream, fcSttbfffn, lcbSttbfffn); - - HWPFFileSystem fileSys = new HWPFFileSystem(); - - _fontTable.writeTo(fileSys); - HWPFOutputStream tableOut = fileSys.getStream("1Table"); - - - byte[] newTableStream = tableOut.toByteArray(); - - - FontTable newFontTable = new FontTable(newTableStream, 0, newTableStream.length); - - assertTrue(_fontTable.equals(newFontTable)); - - } - - protected void setUp() - throws Exception - { - super.setUp(); - /**@todo verify the constructors*/ - _hWPFDocFixture = new HWPFDocFixture(this); - - _hWPFDocFixture.setUp(); - } - - protected void tearDown() - throws Exception - { - _hWPFDocFixture.tearDown(); - - _hWPFDocFixture = null; - super.tearDown(); - } - -} - diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/model/hdftypes/TestPAPBinTable.java b/src/scratchpad/testcases/org/apache/poi/hwpf/model/hdftypes/TestPAPBinTable.java deleted file mode 100644 index 8c4c78faa9..0000000000 --- a/src/scratchpad/testcases/org/apache/poi/hwpf/model/hdftypes/TestPAPBinTable.java +++ /dev/null @@ -1,134 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2003 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" and - * "Apache POI" must not be used to endorse or promote products - * derived from this software without prior written permission. For - * written permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * "Apache POI", nor may "Apache" appear in their name, without - * prior written permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - -package org.apache.poi.hwpf.model.hdftypes; - -import junit.framework.*; -import org.apache.poi.hwpf.*; -import org.apache.poi.hwpf.model.io.*; - -import java.io.*; -import java.util.*; - -public class TestPAPBinTable - extends TestCase -{ - private PAPBinTable _pAPBinTable = null; - private HWPFDocFixture _hWPFDocFixture; - - public TestPAPBinTable(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(); - - _pAPBinTable = new PAPBinTable(mainStream, tableStream, fib.getFcPlcfbtePapx(), fib.getLcbPlcfbtePapx(), fcMin); - - HWPFFileSystem fileSys = new HWPFFileSystem(); - - _pAPBinTable.writeTo(fileSys, 0); - ByteArrayOutputStream tableOut = fileSys.getStream("1Table"); - ByteArrayOutputStream mainOut = fileSys.getStream("WordDocument"); - - byte[] newTableStream = tableOut.toByteArray(); - byte[] newMainStream = mainOut.toByteArray(); - - PAPBinTable newBinTable = new PAPBinTable(newMainStream, newTableStream, 0, newTableStream.length, 0); - - ArrayList oldTextRuns = _pAPBinTable.getParagraphs(); - ArrayList newTextRuns = newBinTable.getParagraphs(); - - assertEquals(oldTextRuns.size(), newTextRuns.size()); - - int size = oldTextRuns.size(); - for (int x = 0; x < size; x++) - { - PropertyNode oldNode = (PropertyNode)oldTextRuns.get(x); - PropertyNode newNode = (PropertyNode)newTextRuns.get(x); - - assertTrue(oldNode.equals(newNode)); - } - - - - - } - - protected void setUp() - throws Exception - { - super.setUp(); - /**@todo verify the constructors*/ - _hWPFDocFixture = new HWPFDocFixture(this); - - _hWPFDocFixture.setUp(); - } - - protected void tearDown() - throws Exception - { - _hWPFDocFixture.tearDown(); - - _hWPFDocFixture = null; - super.tearDown(); - } - -} diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/model/hdftypes/TestPlexOfCps.java b/src/scratchpad/testcases/org/apache/poi/hwpf/model/hdftypes/TestPlexOfCps.java deleted file mode 100644 index 922bd9eb91..0000000000 --- a/src/scratchpad/testcases/org/apache/poi/hwpf/model/hdftypes/TestPlexOfCps.java +++ /dev/null @@ -1,122 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2003 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" and - * "Apache POI" must not be used to endorse or promote products - * derived from this software without prior written permission. For - * written permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * "Apache POI", nor may "Apache" appear in their name, without - * prior written permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - -package org.apache.poi.hwpf.model.hdftypes; - -import junit.framework.*; -import org.apache.poi.hwpf.*; - -import org.apache.poi.util.LittleEndian; - -public class TestPlexOfCps - extends TestCase -{ - private PlexOfCps _plexOfCps = null; - private HWPFDocFixture _hWPFDocFixture; - - public TestPlexOfCps(String name) - { - super(name); - } - public void testWriteRead() - throws Exception - { - _plexOfCps = new PlexOfCps(4); - - int last = 0; - for (int x = 0; x < 110; x++) - { - byte[] intHolder = new byte[4]; - int span = (int)(110.0f * Math.random()); - LittleEndian.putInt(intHolder, span); - _plexOfCps.addProperty(new PropertyNode(last, last + span, intHolder)); - last += span; - } - - byte[] output = _plexOfCps.toByteArray(); - _plexOfCps = new PlexOfCps(output, 0, output.length, 4); - int len = _plexOfCps.length(); - assertEquals(len, 110); - - last = 0; - for (int x = 0; x < len; x++) - { - PropertyNode node = _plexOfCps.getProperty(x); - assertEquals(node.getStart(), last); - last = node.getEnd(); - int span = LittleEndian.getInt(node.getBuf()); - assertEquals(node.getEnd()-node.getStart(), span); - } - } - protected void setUp() - throws Exception - { - super.setUp(); - /**@todo verify the constructors*/ - _hWPFDocFixture = new HWPFDocFixture(this); - - _hWPFDocFixture.setUp(); - } - - protected void tearDown() - throws Exception - { - _plexOfCps = null; - _hWPFDocFixture.tearDown(); - - _hWPFDocFixture = null; - super.tearDown(); - } - -} diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/model/hdftypes/TestSectionTable.java b/src/scratchpad/testcases/org/apache/poi/hwpf/model/hdftypes/TestSectionTable.java deleted file mode 100644 index 94cbb4552a..0000000000 --- a/src/scratchpad/testcases/org/apache/poi/hwpf/model/hdftypes/TestSectionTable.java +++ /dev/null @@ -1,131 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2003 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" and - * "Apache POI" must not be used to endorse or promote products - * derived from this software without prior written permission. For - * written permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * "Apache POI", nor may "Apache" appear in their name, without - * prior written permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - -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 TestSectionTable - extends TestCase -{ - private HWPFDocFixture _hWPFDocFixture; - - public TestSectionTable(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(); - - SectionTable sectionTable = new SectionTable(mainStream, tableStream, - fib.getFcPlcfsed(), - fib.getLcbPlcfsed(), - fcMin); - HWPFFileSystem fileSys = new HWPFFileSystem(); - - sectionTable.writeTo(fileSys, 0); - ByteArrayOutputStream tableOut = fileSys.getStream("1Table"); - ByteArrayOutputStream mainOut = fileSys.getStream("WordDocument"); - - byte[] newTableStream = tableOut.toByteArray(); - byte[] newMainStream = mainOut.toByteArray(); - - SectionTable newSectionTable = new SectionTable(newMainStream, newTableStream, 0, newTableStream.length, 0); - - ArrayList oldSections = sectionTable.getSections(); - ArrayList newSections = newSectionTable.getSections(); - - assertEquals(oldSections.size(), newSections.size()); - - int size = oldSections.size(); - for (int x = 0; x < size; x++) - { - PropertyNode oldNode = (PropertyNode)oldSections.get(x); - PropertyNode newNode = (PropertyNode)newSections.get(x); - assertEquals(oldNode, newNode); - } - } - - protected void setUp() - throws Exception - { - super.setUp(); - /**@todo verify the constructors*/ - _hWPFDocFixture = new HWPFDocFixture(this); - - _hWPFDocFixture.setUp(); - } - - protected void tearDown() - throws Exception - { - _hWPFDocFixture.tearDown(); - - _hWPFDocFixture = null; - super.tearDown(); - } - -} diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/model/hdftypes/TestStyleSheet.java b/src/scratchpad/testcases/org/apache/poi/hwpf/model/hdftypes/TestStyleSheet.java deleted file mode 100644 index 1f22543f25..0000000000 --- a/src/scratchpad/testcases/org/apache/poi/hwpf/model/hdftypes/TestStyleSheet.java +++ /dev/null @@ -1,118 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2003 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" and - * "Apache POI" must not be used to endorse or promote products - * derived from this software without prior written permission. For - * written permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * "Apache POI", nor may "Apache" appear in their name, without - * prior written permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - -package org.apache.poi.hwpf.model.hdftypes; - -import junit.framework.*; - -import org.apache.poi.hwpf.*; -import org.apache.poi.hwpf.model.io.*; -import java.io.*; - -public class TestStyleSheet - extends TestCase -{ - private StyleSheet _styleSheet = null; - private HWPFDocFixture _hWPFDocFixture; - - - public TestStyleSheet(String name) - { - super(name); - } - - public void testReadWrite() - throws Exception - { - HWPFFileSystem fileSys = new HWPFFileSystem(); - - - HWPFOutputStream tableOut = fileSys.getStream("1Table"); - HWPFOutputStream mainOut = fileSys.getStream("WordDocument"); - - _styleSheet.writeTo(tableOut); - - byte[] newTableStream = tableOut.toByteArray(); - - StyleSheet newStyleSheet = new StyleSheet(newTableStream, 0); - assertEquals(newStyleSheet, _styleSheet); - - } - - protected void setUp() - throws Exception - { - super.setUp(); - /**@todo verify the constructors*/ - _hWPFDocFixture = new HWPFDocFixture(this); - _hWPFDocFixture.setUp(); - FileInformationBlock fib = _hWPFDocFixture._fib; - byte[] mainStream = _hWPFDocFixture._mainStream; - byte[] tableStream = _hWPFDocFixture._tableStream; - - _hWPFDocFixture.setUp(); - _styleSheet = new StyleSheet(tableStream, fib.getFcStshf()); - } - - protected void tearDown() - throws Exception - { - _styleSheet = null; - _hWPFDocFixture.tearDown(); - - _hWPFDocFixture = null; - super.tearDown(); - } - -} 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 deleted file mode 100644 index 18987780fd..0000000000 --- a/src/scratchpad/testcases/org/apache/poi/hwpf/model/hdftypes/TestTextPieceTable.java +++ /dev/null @@ -1,69 +0,0 @@ -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