From 337e23c0f1d34d9bda10854969a87cf160d41bea Mon Sep 17 00:00:00 2001 From: Sergey Vladimirov Date: Tue, 20 Sep 2011 08:52:03 +0000 Subject: [PATCH] add test case for sprmTDefTable (opcode 0xD608) git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1173033 13f79535-47bb-0310-9956-ffa450edef68 --- .../hwpf/sprm/TableSprmUncompressorTest.java | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/scratchpad/testcases/org/apache/poi/hwpf/sprm/TableSprmUncompressorTest.java diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/sprm/TableSprmUncompressorTest.java b/src/scratchpad/testcases/org/apache/poi/hwpf/sprm/TableSprmUncompressorTest.java new file mode 100644 index 0000000000..ebd3a9583a --- /dev/null +++ b/src/scratchpad/testcases/org/apache/poi/hwpf/sprm/TableSprmUncompressorTest.java @@ -0,0 +1,43 @@ +package org.apache.poi.hwpf.sprm; + +import org.apache.poi.hwpf.usermodel.TableProperties; + +import junit.framework.TestCase; + +public class TableSprmUncompressorTest extends TestCase +{ + public void testSprmTDefTable() + { + final byte[] example = { (byte) 0x08, (byte) 0xD6, (byte) 0x2F, + (byte) 0x00, (byte) 0x02, (byte) 0x94, (byte) 0xFF, + (byte) 0x53, (byte) 0x03, (byte) 0x60, (byte) 0x13, + (byte) 0x00, (byte) 0x06, (byte) 0xBF, (byte) 0x03, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x06, (byte) 0x0D, (byte) 0x10, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 }; + + SprmOperation sprmOperation = new SprmOperation( example, 0 ); + assertEquals( SprmOperation.TYPE_TAP, sprmOperation.getType() ); + assertEquals( (short) 0x08, sprmOperation.getOperation() ); + + TableProperties tableProperties = new TableProperties(); + TableSprmUncompressor.unCompressTAPOperation( tableProperties, + sprmOperation ); + + assertEquals( 2, tableProperties.getItcMac() ); + assertEquals( 3, tableProperties.getRgdxaCenter().length ); + assertEquals( (short) 0xff94, tableProperties.getRgdxaCenter()[0] ); + assertEquals( (short) 0x0353, tableProperties.getRgdxaCenter()[1] ); + assertEquals( (short) 0x1360, tableProperties.getRgdxaCenter()[2] ); + + assertEquals( 2, tableProperties.getRgtc().length ); + assertEquals( (short) 0x03bf, tableProperties.getRgtc()[0].getWWidth() ); + assertEquals( (short) 0x100d, tableProperties.getRgtc()[1].getWWidth() ); + } +} \ No newline at end of file -- 2.39.5