add test case for sprmTDefTable (opcode 0xD608)

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1173033 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sergey Vladimirov 2011-09-20 08:52:03 +00:00
parent dfa4805ce7
commit 337e23c0f1
1 changed files with 43 additions and 0 deletions

View File

@ -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() );
}
}