TestEscherDggRecordpublic class TestEscherDggRecord extends TestCase
Methods Summary |
---|
private org.apache.poi.ddf.EscherDggRecord | createRecord()
EscherDggRecord r = new EscherDggRecord();
r.setOptions( (short) 0x0000 );
r.setRecordId( EscherDggRecord.RECORD_ID );
r.setShapeIdMax( 0x402 );
r.setNumShapesSaved( 0x02 );
r.setDrawingsSaved( 0x01 );
r.setFileIdClusters(new EscherDggRecord.FileIdCluster[] {
new EscherDggRecord.FileIdCluster( 1, 2 )
});
return r;
| public void | testFillFields()
String hexData = "00 00 " +
"06 F0 " +
"18 00 00 00 " +
"02 04 00 00 " +
"02 00 00 00 " +
"02 00 00 00 " +
"01 00 00 00 " +
"01 00 00 00 02 00 00 00";
byte[] data = HexRead.readFromString( hexData );
EscherDggRecord r = new EscherDggRecord();
int bytesWritten = r.fillFields( data, new DefaultEscherRecordFactory() );
assertEquals( 32, bytesWritten );
assertEquals( 0x402, r.getShapeIdMax() );
assertEquals( 0x02, r.getNumIdClusters() );
assertEquals( 0x02, r.getNumShapesSaved() );
assertEquals( 0x01, r.getDrawingsSaved() );
assertEquals( 1, r.getFileIdClusters().length );
assertEquals( 0x01, r.getFileIdClusters()[0].getDrawingGroupId());
assertEquals( 0x02, r.getFileIdClusters()[0].getNumShapeIdsUsed());
| public void | testGetRecordSize()
EscherDggRecord r = new EscherDggRecord();
r.setFileIdClusters(new EscherDggRecord.FileIdCluster[] { new EscherDggRecord.FileIdCluster(0,0) } );
assertEquals(32,r.getRecordSize());
| public void | testSerialize()
EscherDggRecord r = createRecord();
byte[] data = new byte[32];
int bytesWritten = r.serialize( 0, data, new NullEscherSerializationListener() );
assertEquals( 32, bytesWritten );
assertEquals( "[00, 00, " +
"06, F0, " +
"18, 00, 00, 00, " +
"02, 04, 00, 00, " +
"02, 00, 00, 00, " +
"02, 00, 00, 00, " +
"01, 00, 00, 00, " +
"01, 00, 00, 00, 02, 00, 00, 00, ]",
HexDump.toHex( data ) );
| public void | testToString()
String nl = System.getProperty("line.separator");
String expected = "org.apache.poi.ddf.EscherDggRecord:" + nl +
" RecordId: 0xF006" + nl +
" Options: 0x0000" + nl +
" ShapeIdMax: 1026" + nl +
" NumIdClusters: 2" + nl +
" NumShapesSaved: 2" + nl +
" DrawingsSaved: 1" + nl +
" DrawingGroupId1: 1" + nl +
" NumShapeIdsUsed1: 2" + nl;
assertEquals( expected, createRecord().toString() );
|
|