TestDrawingManagerpublic class TestDrawingManager extends TestCase
Methods Summary |
---|
public void | testAllocateShapeId()
EscherDggRecord dgg = new EscherDggRecord();
dgg.setDrawingsSaved( 0 );
dgg.setFileIdClusters( new EscherDggRecord.FileIdCluster[]{} );
DrawingManager dm = new DrawingManager( dgg );
EscherDgRecord dg = dm.createDgRecord();
int shapeId = dm.allocateShapeId( dg.getDrawingGroupId() );
assertEquals( 1024, shapeId );
assertEquals( 1025, dgg.getShapeIdMax() );
assertEquals( 1, dgg.getDrawingsSaved() );
assertEquals( 1, dgg.getFileIdClusters()[0].getDrawingGroupId() );
assertEquals( 1, dgg.getFileIdClusters()[0].getNumShapeIdsUsed() );
assertEquals( 1024, dg.getLastMSOSPID() );
assertEquals( 1, dg.getNumShapes() );
| public void | testCreateDgRecord()
EscherDggRecord dgg = new EscherDggRecord();
dgg.setDrawingsSaved( 0 );
dgg.setFileIdClusters( new EscherDggRecord.FileIdCluster[]{} );
DrawingManager dm = new DrawingManager( dgg );
EscherDgRecord dgRecord = dm.createDgRecord();
assertEquals( -1, dgRecord.getLastMSOSPID() );
assertEquals( 0, dgRecord.getNumShapes() );
assertEquals( 1, dm.getDgg().getDrawingsSaved() );
assertEquals( 1, dm.getDgg().getFileIdClusters().length );
assertEquals( 1, dm.getDgg().getFileIdClusters()[0].getDrawingGroupId() );
assertEquals( 0, dm.getDgg().getFileIdClusters()[0].getNumShapeIdsUsed() );
| public void | testDrawingGroupExists()
EscherDggRecord dgg = new EscherDggRecord();
dgg.setDrawingsSaved( 1 );
dgg.setFileIdClusters( new EscherDggRecord.FileIdCluster[]{
new EscherDggRecord.FileIdCluster( 2, 10 )} );
DrawingManager dm = new DrawingManager( dgg );
assertFalse( dm.drawingGroupExists( (short) 1 ) );
assertTrue( dm.drawingGroupExists( (short) 2 ) );
assertFalse( dm.drawingGroupExists( (short) 3 ) );
| public void | testFindFreeSPIDBlock()
EscherDggRecord dgg = new EscherDggRecord();
DrawingManager dm = new DrawingManager( dgg );
dgg.setShapeIdMax( 1024 );
assertEquals( 2048, dm.findFreeSPIDBlock() );
dgg.setShapeIdMax( 1025 );
assertEquals( 2048, dm.findFreeSPIDBlock() );
dgg.setShapeIdMax( 2047 );
assertEquals( 2048, dm.findFreeSPIDBlock() );
| public void | testFindNewDrawingGroupId()
EscherDggRecord dgg = new EscherDggRecord();
dgg.setDrawingsSaved( 1 );
dgg.setFileIdClusters( new EscherDggRecord.FileIdCluster[]{
new EscherDggRecord.FileIdCluster( 2, 10 )} );
DrawingManager dm = new DrawingManager( dgg );
assertEquals( 1, dm.findNewDrawingGroupId() );
dgg.setFileIdClusters( new EscherDggRecord.FileIdCluster[]{
new EscherDggRecord.FileIdCluster( 1, 10 ),
new EscherDggRecord.FileIdCluster( 2, 10 )} );
assertEquals( 3, dm.findNewDrawingGroupId() );
|
|