use of org.apache.poi.ddf.EscherDggRecord in project poi by apache.
the class TestDrawingManager method testAllocateShapeId.
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());
}
use of org.apache.poi.ddf.EscherDggRecord in project poi by apache.
the class TestDrawingManager method testDrawingGroupExists.
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));
}
use of org.apache.poi.ddf.EscherDggRecord in project poi by apache.
the class TestDrawingManager method testCreateDgRecord.
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());
}
use of org.apache.poi.ddf.EscherDggRecord in project poi by apache.
the class TestDrawingManager method testFindFreeSPIDBlock.
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());
}
use of org.apache.poi.ddf.EscherDggRecord in project poi by apache.
the class TestDrawingManager2 method setUp.
@Override
protected void setUp() {
dgg = new EscherDggRecord();
dgg.setFileIdClusters(new EscherDggRecord.FileIdCluster[0]);
drawingManager2 = new DrawingManager2(dgg);
}
Aggregations