public void testSerialize() throws Exception {
EscherBlipRecord r = new EscherBlipRecord();
r.setBoundaryLeft(1);
r.setBoundaryHeight(2);
r.setBoundaryTop(3);
r.setBoundaryWidth(4);
r.setCacheOfSavedSize(5);
r.setCacheOfSize(6);
r.setFilter((byte)7);
r.setCompressionFlag((byte)8);
r.setSecondaryUID(new byte[] { (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01,
(byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01,
(byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01,
(byte)0x01, (byte)0x01, (byte)0x01, (byte)0x01, });
r.setWidth(10);
r.setHeight(11);
r.setRecordId(EscherBlipRecord.RECORD_ID_START);
r.setOptions((short)5420);
r.setData(new byte[] { (byte)0x01, (byte)0x02 } );
byte[] buf = new byte[r.getRecordSize()];
r.serialize(0, buf, new NullEscherSerializationListener() );
assertEquals("[2C, 15, 18, F0, 26, 00, 00, 00, " +
"01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, 01, " +
"06, 00, 00, 00, " + // field_2_cacheOfSize
"03, 00, 00, 00, " + // field_3_boundaryTop
"01, 00, 00, 00, " + // field_4_boundaryLeft
"04, 00, 00, 00, " + // field_5_boundaryWidth
"02, 00, 00, 00, " + // field_6_boundaryHeight
"0A, 00, 00, 00, " + // field_7_x
"0B, 00, 00, 00, " + // field_8_y
"05, 00, 00, 00, " + // field_9_cacheOfSavedSize
"08, " + // field_10_compressionFlag
"07, " + // field_11_filter
"01, 02, ]", // field_12_data
HexDump.toHex(buf));
assertEquals(60, r.getRecordSize() );
}
|