diff options
author | Nick Burch <nick@apache.org> | 2008-08-30 16:59:55 +0000 |
---|---|---|
committer | Nick Burch <nick@apache.org> | 2008-08-30 16:59:55 +0000 |
commit | 3d8ec0dc34a6d61b41bcdfcad3b3ed243dbf9d26 (patch) | |
tree | 98b23ad8cac3eea425d26a96943df5ae7c73235e /src/scratchpad/testcases/org/apache/poi/hpbf/model/TestQuillContents.java | |
parent | e12de2c3bfc897abf17dbd0bdcbc7e3dc8a3e257 (diff) | |
download | poi-3d8ec0dc34a6d61b41bcdfcad3b3ed243dbf9d26.tar.gz poi-3d8ec0dc34a6d61b41bcdfcad3b3ed243dbf9d26.zip |
Start to support HPBF PLC parts
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@690534 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/scratchpad/testcases/org/apache/poi/hpbf/model/TestQuillContents.java')
-rw-r--r-- | src/scratchpad/testcases/org/apache/poi/hpbf/model/TestQuillContents.java | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/src/scratchpad/testcases/org/apache/poi/hpbf/model/TestQuillContents.java b/src/scratchpad/testcases/org/apache/poi/hpbf/model/TestQuillContents.java index ce6ddf83ef..ecbc226098 100644 --- a/src/scratchpad/testcases/org/apache/poi/hpbf/model/TestQuillContents.java +++ b/src/scratchpad/testcases/org/apache/poi/hpbf/model/TestQuillContents.java @@ -21,6 +21,8 @@ import java.io.FileInputStream; import org.apache.poi.hpbf.HPBFDocument; import org.apache.poi.hpbf.model.qcbits.QCTextBit; +import org.apache.poi.hpbf.model.qcbits.QCPLCBit.Type4; +import org.apache.poi.hpbf.model.qcbits.QCPLCBit.Type8; import junit.framework.TestCase; @@ -77,4 +79,65 @@ public class TestQuillContents extends TestCase { assertTrue(t.startsWith("This is some text on the first page")); assertTrue(t.endsWith("Within doc to page 1\r")); } + + public void testPLC() throws Exception { + File f = new File(dir, "Simple.pub"); + HPBFDocument doc = new HPBFDocument( + new FileInputStream(f) + ); + + QuillContents qc = doc.getQuillContents(); + assertEquals(20, qc.getBits().length); + + assertTrue(qc.getBits()[9] instanceof Type4); + assertTrue(qc.getBits()[10] instanceof Type4); + assertTrue(qc.getBits()[12] instanceof Type8); + + Type4 plc9 = (Type4)qc.getBits()[9]; + Type4 plc10 = (Type4)qc.getBits()[10]; + Type8 plc12 = (Type8)qc.getBits()[12]; + + + assertEquals(1, plc9.getNumberOfPLCs()); + assertEquals(4, plc9.getPreData().length); + assertEquals(1, plc9.getPlcValA().length); + assertEquals(1, plc9.getPlcValB().length); + + assertEquals(0, plc9.getPreData()[0]); + assertEquals(0, plc9.getPreData()[1]); + assertEquals(0, plc9.getPreData()[2]); + assertEquals(0, plc9.getPreData()[3]); + assertEquals(0x356, plc9.getPlcValA()[0]); + assertEquals(0x600, plc9.getPlcValB()[0]); + + + assertEquals(1, plc10.getNumberOfPLCs()); + assertEquals(4, plc10.getPreData().length); + assertEquals(1, plc10.getPlcValA().length); + assertEquals(1, plc10.getPlcValB().length); + + assertEquals(0, plc10.getPreData()[0]); + assertEquals(0, plc10.getPreData()[1]); + assertEquals(0, plc10.getPreData()[2]); + assertEquals(0, plc10.getPreData()[3]); + assertEquals(0x356, plc10.getPlcValA()[0]); + assertEquals(0x800, plc10.getPlcValB()[0]); + + assertEquals(2, plc12.getNumberOfPLCs()); + assertEquals(7, plc12.getPreData().length); + assertEquals(2, plc12.getPlcValA().length); + assertEquals(2, plc12.getPlcValB().length); + + assertEquals(0xff, plc12.getPreData()[0]); + assertEquals(0, plc12.getPreData()[1]); + assertEquals(0x3d, plc12.getPreData()[2]); + assertEquals(0, plc12.getPreData()[3]); + assertEquals(0x6e, plc12.getPreData()[4]); + assertEquals(0, plc12.getPreData()[5]); + assertEquals(0, plc12.getPreData()[6]); + assertEquals(0xa0000, plc12.getPlcValA()[0]); + assertEquals(0x22000000, plc12.getPlcValB()[0]); + assertEquals(0x05, plc12.getPlcValA()[1]); + assertEquals(0x04, plc12.getPlcValB()[1]); + } } |