You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by se...@apache.org on 2011/09/20 10:52:03 UTC

svn commit: r1173033 - /poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/sprm/TableSprmUncompressorTest.java

Author: sergey
Date: Tue Sep 20 08:52:03 2011
New Revision: 1173033

URL: http://svn.apache.org/viewvc?rev=1173033&view=rev
Log:
add test case for sprmTDefTable (opcode 0xD608)

Added:
    poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/sprm/TableSprmUncompressorTest.java

Added: poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/sprm/TableSprmUncompressorTest.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/sprm/TableSprmUncompressorTest.java?rev=1173033&view=auto
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/sprm/TableSprmUncompressorTest.java (added)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/sprm/TableSprmUncompressorTest.java Tue Sep 20 08:52:03 2011
@@ -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



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org